Turn obj.collect and obj.customcollect into plain arrays

Since they're always fixed-size, there's no need for them to be vectors.

Also added an INBOUNDS_ARR() macro to do bounds checks with plain
arrays.
This commit is contained in:
Misa
2020-07-02 19:17:32 -07:00
committed by Ethan Lee
parent 62203efb2c
commit 0664eac7fc
5 changed files with 28 additions and 77 deletions

View File

@@ -1959,8 +1959,8 @@ void scriptclass::run()
music.haltdasmusik();
music.playef(3);
int trinket = ss_toi(words[1]);
if (trinket >= 0 && trinket < (int) obj.collect.size())
size_t trinket = ss_toi(words[1]);
if (trinket < SDL_arraysize(obj.collect))
{
obj.collect[trinket] = true;
}
@@ -3707,10 +3707,8 @@ void scriptclass::hardreset()
obj.customcrewmoods[i]=true;
}
obj.collect.clear();
obj.collect.resize(100);
obj.customcollect.clear();
obj.customcollect.resize(100);
SDL_memset(obj.collect, false, sizeof(obj.collect));
SDL_memset(obj.customcollect, false, sizeof(obj.customcollect));
i = 100; //previously a for-loop iterating over collect/customcollect set this to 100
int theplayer = obj.getplayer();