1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 09:39:43 +01:00

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.
This commit is contained in:
Info Teddy 2020-01-15 17:36:05 -08:00 committed by Ethan Lee
parent 921e288ebe
commit 5b2962fde0

View file

@ -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;
}
}