mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-04 17:41:23 +01:00
refactor: optimize route deletion logic in RoutesModule
This commit is contained in:
parent
ff74fa9292
commit
bb94044320
1 changed files with 2 additions and 3 deletions
|
|
@ -694,12 +694,11 @@ class RoutesModule {
|
||||||
for (const point of route.points) {
|
for (const point of route.points) {
|
||||||
const from = point[2];
|
const from = point[2];
|
||||||
if (!routes[from]) continue;
|
if (!routes[from]) continue;
|
||||||
console.log(Object.entries(routes[from]));
|
|
||||||
|
|
||||||
for (const [to, routeId] of Object.entries(routes[from])) {
|
for (const [to, routeId] of Object.entries(routes[from])) {
|
||||||
if (routeId === route.i) {
|
if (routeId === route.i) {
|
||||||
delete routes[from][to];
|
delete routes[from][parseInt(to, 10)];
|
||||||
delete routes[to][from];
|
delete routes[parseInt(to, 10)][from];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue