diff --git a/src/core/execution/PlayerExecution.ts b/src/core/execution/PlayerExecution.ts index 9640fb244..11a60a89c 100644 --- a/src/core/execution/PlayerExecution.ts +++ b/src/core/execution/PlayerExecution.ts @@ -148,6 +148,11 @@ export class PlayerExecution implements Execution { private removeCluster(cluster: Set) { const arr = Array.from(cluster) + if (arr.some(t => t.owner() != this.player)) { + // Other removeCluster operations could change tile owners, + // so double check. + return + } const mode = getMode(arr.flatMap(t => t.neighbors()).filter(t => t.hasOwner() && t.owner() != this.player).map(t => t.owner().id())) if (!this.mg.hasPlayer(mode)) { consolex.warn('mode is not found')