mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 18:04:09 +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:
@@ -111,7 +111,7 @@ void scriptclass::run()
|
||||
int temprx=ss_toi(words[1])-1;
|
||||
int tempry=ss_toi(words[2])-1;
|
||||
int curlevel=temprx+(ed.maxwidth*(tempry));
|
||||
bool inbounds = curlevel >= 0 && curlevel < 400;
|
||||
bool inbounds = INBOUNDS_ARR(curlevel, ed.level);
|
||||
if (inbounds)
|
||||
{
|
||||
ed.level[curlevel].warpdir=ss_toi(words[3]);
|
||||
@@ -151,7 +151,7 @@ void scriptclass::run()
|
||||
if (words[0] == "ifwarp")
|
||||
{
|
||||
int room = ss_toi(words[1])-1+(ed.maxwidth*(ss_toi(words[2])-1));
|
||||
if (room >= 0 && room < 400 && ed.level[room].warpdir == ss_toi(words[3]))
|
||||
if (INBOUNDS_ARR(room, ed.level) && ed.level[room].warpdir == ss_toi(words[3]))
|
||||
{
|
||||
load("custom_"+words[4]);
|
||||
position--;
|
||||
|
||||
Reference in New Issue
Block a user