Fix stacking bug and bump version, fixes #814

pull/839/head
tobspr 4 years ago
parent 1ac0fe5387
commit 1ab0fb7d9c

@ -1,4 +1,12 @@
export const CHANGELOG = [ export const CHANGELOG = [
{
version: "1.2.1",
date: "unreleased",
entries: [
"Fixed stacking bug for level 26 which required restarting the game",
"Updated translations",
],
},
{ {
version: "1.2.0", version: "1.2.0",
date: "09.10.2020", date: "09.10.2020",

@ -31,7 +31,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
*/ */
this.shapeKeyToItem = {}; this.shapeKeyToItem = {};
// Caches operations in the form of 'operation:def1[:def2]' // Caches operations in the form of 'operation/def1[/def2]'
/** @type {Object.<string, Array<ShapeDefinition>|ShapeDefinition>} */ /** @type {Object.<string, Array<ShapeDefinition>|ShapeDefinition>} */
this.operationCache = {}; this.operationCache = {};
} }
@ -89,7 +89,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {[ShapeDefinition, ShapeDefinition]} * @returns {[ShapeDefinition, ShapeDefinition]}
*/ */
shapeActionCutHalf(definition) { shapeActionCutHalf(definition) {
const key = "cut:" + definition.getHash(); const key = "cut/" + definition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key]); return /** @type {[ShapeDefinition, ShapeDefinition]} */ (this.operationCache[key]);
} }
@ -108,7 +108,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {[ShapeDefinition, ShapeDefinition, ShapeDefinition, ShapeDefinition]} * @returns {[ShapeDefinition, ShapeDefinition, ShapeDefinition, ShapeDefinition]}
*/ */
shapeActionCutQuad(definition) { shapeActionCutQuad(definition) {
const key = "cut-quad:" + definition.getHash(); const key = "cut-quad/" + definition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {[ShapeDefinition, ShapeDefinition, ShapeDefinition, ShapeDefinition]} */ (this return /** @type {[ShapeDefinition, ShapeDefinition, ShapeDefinition, ShapeDefinition]} */ (this
.operationCache[key]); .operationCache[key]);
@ -130,7 +130,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionRotateCW(definition) { shapeActionRotateCW(definition) {
const key = "rotate-cw:" + definition.getHash(); const key = "rotate-cw/" + definition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }
@ -148,7 +148,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionRotateCCW(definition) { shapeActionRotateCCW(definition) {
const key = "rotate-ccw:" + definition.getHash(); const key = "rotate-ccw/" + definition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }
@ -166,7 +166,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionRotate180(definition) { shapeActionRotate180(definition) {
const key = "rotate-fl:" + definition.getHash(); const key = "rotate-fl/" + definition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }
@ -185,7 +185,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionStack(lowerDefinition, upperDefinition) { shapeActionStack(lowerDefinition, upperDefinition) {
const key = "stack:" + lowerDefinition.getHash() + ":" + upperDefinition.getHash(); const key = "stack/" + lowerDefinition.getHash() + "/" + upperDefinition.getHash();
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }
@ -202,7 +202,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionPaintWith(definition, color) { shapeActionPaintWith(definition, color) {
const key = "paint:" + definition.getHash() + ":" + color; const key = "paint/" + definition.getHash() + "/" + color;
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }
@ -219,7 +219,7 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
* @returns {ShapeDefinition} * @returns {ShapeDefinition}
*/ */
shapeActionPaintWith4Colors(definition, colors) { shapeActionPaintWith4Colors(definition, colors) {
const key = "paint4:" + definition.getHash() + ":" + colors.join(","); const key = "paint4/" + definition.getHash() + "/" + colors.join(",");
if (this.operationCache[key]) { if (this.operationCache[key]) {
return /** @type {ShapeDefinition} */ (this.operationCache[key]); return /** @type {ShapeDefinition} */ (this.operationCache[key]);
} }

@ -1 +1 @@
1.2.0 1.2.1
Loading…
Cancel
Save