From 5b2962fde01b14342cea98a1e04a525d11102599 Mon Sep 17 00:00:00 2001 From: Info Teddy Date: Wed, 15 Jan 2020 17:36:05 -0800 Subject: [PATCH] Properly reset roomdeaths and roomdeathsfinal in hardreset There are three map-related vectors that need to be reset in hardreset: `map.roomdeaths`, `map.roomdeathsfinal`, and `map.explored`. All three of these vectors use the concatenated rows system, whereby each room is given a room number, calculated by doing X + Y*20, and this becomes their index in each vector. There's a double-nested for-loop to handle resetting all of these, where the outer for-loop iterates over the Y-axis and the inner for-loop iterates over the X-axis, but only `map.explored` is properly reset. That's because it's the only vector that properly indexes using X + Y*20. The other vectors reset using X, so previously, only the first row of `map.roomdeaths` and `map.roomdeathsfinal` got reset, corresponding with only the first row of rooms in both Dimension VVVVVV and Outside Dimension VVVVVV getting reset. This commit makes sure that both get reset properly. --- desktop_version/src/Script.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index b552fac9..98ecd90e 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -3520,8 +3520,8 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass& { for (i = 0; i < 20; i++) { - map.roomdeaths[i] = 0; - map.roomdeathsfinal[i] = 0; + map.roomdeaths[i + (j * 20)] = 0; + map.roomdeathsfinal[i + (j * 20)] = 0; map.explored[i + (j * 20)] = 0; } }