diff options
author | MetroWind <chris.corsair@gmail.com> | 2025-08-31 22:07:18 -0700 |
---|---|---|
committer | MetroWind <chris.corsair@gmail.com> | 2025-08-31 22:07:18 -0700 |
commit | 7854244c0318f590e0f198ec72dfd55afdd1bc91 (patch) | |
tree | c52d1d48df86a74e1442c6b70297cc102df2059c /scripts | |
parent | 897268c771b3ab39944761666b8511f0a69baf4b (diff) |
Correctly initialize the plan array.
Similar to python, filling the array with an array just create
references. We need actual copies.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/main.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/main.js b/scripts/main.js index 8df176b..8f3bbee 100644 --- a/scripts/main.js +++ b/scripts/main.js | |||
@@ -1,6 +1,6 @@ | |||
1 | const DEFAULT_APP_STATE = { | 1 | const DEFAULT_APP_STATE = { |
2 | floor: 0, // This is 0-based. | 2 | floor: 0, // This is 0-based. |
3 | plan: new Array(FLOOR_COUNT).fill( | 3 | plan: new Array(FLOOR_COUNT).fill(null).map(() => |
4 | new Array(GRID_SIZE_X * GRID_SIZE_Y).fill(0)), | 4 | new Array(GRID_SIZE_X * GRID_SIZE_Y).fill(0)), |
5 | // mouse_state can be “normal”, or “dnd”. | 5 | // mouse_state can be “normal”, or “dnd”. |
6 | mouse_state: "normal", | 6 | mouse_state: "normal", |