From 2b1dd01a1e7d87b07a97ce657bbf202273dca3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20Gergely?= Date: Tue, 14 Sep 2021 22:13:50 +0200 Subject: [PATCH] FIX: incorrect province copy and minor fix of rebels --- main.js | 1 + modules/submap.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 8d5f55ef..acbaafbe 100644 --- a/main.js +++ b/main.js @@ -1695,6 +1695,7 @@ function addZones(number = 1) { if (!state) return; const neib = ra(state.neighbors.filter(n => n && !states[n].removed)); + if (!neib) return; const cell = cells.i.find(i => cells.state[i] === state.i && !state.removed && cells.c[i].some(c => cells.state[c] === neib)); const cellsArray = [], queue = [], diff --git a/modules/submap.js b/modules/submap.js index d3af502e..b95369cb 100644 --- a/modules/submap.js +++ b/modules/submap.js @@ -248,7 +248,7 @@ window.Submap = (function () { const validProvinces = new Set(pack.cells.province); pack.provinces = parentMap.pack.provinces; // mark uneccesary provinces - pack.states.forEach((s, i) => { + pack.provinces.forEach((s, i) => { if (s.removed) return; if (!validProvinces.has(i)) s.removed = true; });