From 656941202a72865e313ed001e482896d27923b44 Mon Sep 17 00:00:00 2001 From: AllyTally Date: Thu, 22 Apr 2021 22:33:03 -0300 Subject: [PATCH] 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. --- desktop_version/src/Entity.cpp | 4 +++- desktop_version/src/Script.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index 7d6e7117..58a43b37 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -1056,7 +1056,9 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*= if (custom) { block.prompt = "Press %s to interact"; - } else { + } + else + { block.prompt = "Press %s to activate terminal"; } block.script = "custom_"+customscript; diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index c688f436..4a2951ca 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1909,8 +1909,11 @@ void scriptclass::run(void) } else if (words[0] == "setactivitytext") { - position++; - obj.customactivitytext = commands[position]; + ++position; + if (INBOUNDS_VEC(position, commands)) + { + obj.customactivitytext = commands[position]; + } } else if (words[0] == "createrescuedcrew") {