mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 01:51:23 +01:00
fix: clean up neighbors references on state removal
This commit is contained in:
parent
844fc15891
commit
ed3cc83fed
3 changed files with 8 additions and 2 deletions
|
|
@ -640,6 +640,12 @@ function stateRemove(stateId) {
|
|||
});
|
||||
armies.select("g#army" + stateId).remove();
|
||||
|
||||
// clean up neighbors references from other states
|
||||
pack.states.forEach(state => {
|
||||
if (!state.i || state.removed || !state.neighbors) return;
|
||||
state.neighbors = state.neighbors.filter(n => n !== stateId);
|
||||
});
|
||||
|
||||
pack.states[stateId] = {i: stateId, removed: true};
|
||||
|
||||
debug.selectAll(".highlight").remove();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue