mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.6.23 - rivers remove fix
This commit is contained in:
parent
30b5a2564b
commit
845f2e99f5
2 changed files with 2 additions and 1 deletions
|
|
@ -344,7 +344,7 @@ const getName = function(cell) {
|
||||||
// remove river and all its tributaries
|
// remove river and all its tributaries
|
||||||
const remove = function(id) {
|
const remove = function(id) {
|
||||||
const cells = pack.cells;
|
const cells = pack.cells;
|
||||||
const riversToRemove = pack.rivers.filter(r => r.basin === id).map(r => r.i);
|
const riversToRemove = pack.rivers.filter(r => r.i === id || r.parent === id || r.basin === id).map(r => r.i);
|
||||||
riversToRemove.forEach(r => rivers.select("#river"+r).remove());
|
riversToRemove.forEach(r => rivers.select("#river"+r).remove());
|
||||||
cells.r.forEach((r, i) => {
|
cells.r.forEach((r, i) => {
|
||||||
if (!r || !riversToRemove.includes(r)) return;
|
if (!r || !riversToRemove.includes(r)) return;
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,7 @@ function editRiver(id) {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
const river = +elSelected.attr("id").slice(5);
|
const river = +elSelected.attr("id").slice(5);
|
||||||
Rivers.remove(river);
|
Rivers.remove(river);
|
||||||
|
elSelected.remove(); // keep if river if missed in pack.rivers
|
||||||
$("#riverEditor").dialog("close");
|
$("#riverEditor").dialog("close");
|
||||||
},
|
},
|
||||||
Cancel: function() {$(this).dialog("close");}
|
Cancel: function() {$(this).dialog("close");}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue