mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03:00
Don't manually write out INBOUNDS_ARR() checks
When this is done, there is potential for a mistake to occur when writing out the bounds check, which is eliminated when using the macro instead. Luckily, this doesn't seem to have happened, but what's even worse is I hardcoded 400 instead of using SDL_arraysize(ed.level), so if the size of ed.level the bounds checks would all be wrong, which wouldn't be good. But that's fixed now, too.
This commit is contained in:
@@ -1567,7 +1567,7 @@ void editorclass::switch_tileset(const bool reversed /*= false*/)
|
||||
{
|
||||
const char* tilesets[] = {"Space Station", "Outside", "Lab", "Warp Zone", "Ship"};
|
||||
const size_t roomnum = levx + levy*maxwidth;
|
||||
if (roomnum >= SDL_arraysize(level))
|
||||
if (!INBOUNDS_ARR(roomnum, level))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ void editorclass::switch_tileset(const bool reversed /*= false*/)
|
||||
void editorclass::switch_tilecol(const bool reversed /*= false*/)
|
||||
{
|
||||
const size_t roomnum = levx + levy*maxwidth;
|
||||
if (roomnum >= SDL_arraysize(level))
|
||||
if (!INBOUNDS_ARR(roomnum, level))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1626,7 +1626,7 @@ void editorclass::switch_tilecol(const bool reversed /*= false*/)
|
||||
void editorclass::clamp_tilecol(const int rx, const int ry, const bool wrap /*= false*/)
|
||||
{
|
||||
const size_t roomnum = rx + ry*maxwidth;
|
||||
if (roomnum >= SDL_arraysize(level))
|
||||
if (!INBOUNDS_ARR(roomnum, level))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1676,7 +1676,7 @@ void editorclass::clamp_tilecol(const int rx, const int ry, const bool wrap /*=
|
||||
void editorclass::switch_enemy(const bool reversed /*= false*/)
|
||||
{
|
||||
const size_t roomnum = levx + levy*maxwidth;
|
||||
if (roomnum >= SDL_arraysize(level))
|
||||
if (!INBOUNDS_ARR(roomnum, level))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user