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

Fix formatting and add an INBOUNDS_VEC

If `setactivitytext` was the last line in a script,
the command would index the vector out of bounds.

I also modified the formatting to keep consistent
with the rest of the codebase.
This commit is contained in:
AllyTally 2021-04-22 22:33:03 -03:00 committed by Misa Elizabeth Kai
parent b15e25f106
commit 656941202a
2 changed files with 8 additions and 3 deletions

View file

@ -1056,7 +1056,9 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
if (custom) if (custom)
{ {
block.prompt = "Press %s to interact"; block.prompt = "Press %s to interact";
} else { }
else
{
block.prompt = "Press %s to activate terminal"; block.prompt = "Press %s to activate terminal";
} }
block.script = "custom_"+customscript; block.script = "custom_"+customscript;

View file

@ -1909,8 +1909,11 @@ void scriptclass::run(void)
} }
else if (words[0] == "setactivitytext") else if (words[0] == "setactivitytext")
{ {
position++; ++position;
obj.customactivitytext = commands[position]; if (INBOUNDS_VEC(position, commands))
{
obj.customactivitytext = commands[position];
}
} }
else if (words[0] == "createrescuedcrew") else if (words[0] == "createrescuedcrew")
{ {