Turn map.explored, map.roomdeaths(final) into plain arrays

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

Also used the new INBOUNDS_ARR() macro for the map.explored bounds
checks in Script.cpp, and made map.explored a proper bool array instead
of an int array.
This commit is contained in:
Misa
2020-07-02 21:01:09 -07:00
committed by Ethan Lee
parent 118008d824
commit cb3afa295a
4 changed files with 22 additions and 62 deletions

View File

@@ -64,9 +64,9 @@ mapclass::mapclass()
//We create a blank map
contents.resize(40 * 30);
roomdeaths.resize(20 * 20);
roomdeathsfinal.resize(20 * 20);
explored.resize(20 * 20);
SDL_memset(roomdeaths, 0, sizeof(roomdeaths));
SDL_memset(roomdeathsfinal, 0, sizeof(roomdeathsfinal));
resetmap();
tileset = 0;
initmapdata();
@@ -133,8 +133,7 @@ void mapclass::settrinket(int x, int y)
void mapclass::resetmap()
{
//clear the explored area of the map
explored.clear();
explored.resize(20 * 20);
SDL_memset(explored, 0, sizeof(explored));
}
void mapclass::resetnames()
@@ -1167,7 +1166,7 @@ void mapclass::loadlevel(int rx, int ry)
int t;
if (!finalmode)
{
explored[rx - 100 + ((ry - 100) * 20)] = 1;
explored[rx - 100 + ((ry - 100) * 20)] = true;
if (rx == 109 && !custommode)
{
exploretower();