summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2024-08-03 20:05:30 -0300
committerJesusaves <cpntb1@ymail.com>2024-08-03 20:05:30 -0300
commitceb3552310203d9053250bad72415a8fdc43d716 (patch)
tree6cbd8c5cc07f1d17a2e86a657926999f5b426323
parent714d7cdf513628d76efcae99d76a61413e0cd550 (diff)
downloadevol-hercules-ceb3552310203d9053250bad72415a8fdc43d716.tar.gz
evol-hercules-ceb3552310203d9053250bad72415a8fdc43d716.tar.bz2
evol-hercules-ceb3552310203d9053250bad72415a8fdc43d716.tar.xz
evol-hercules-ceb3552310203d9053250bad72415a8fdc43d716.zip
setq with illegal quest <= 0: Abort script execution, report error
-rw-r--r--src/emap/script_buildins.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 177b65c..b01d100 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -578,6 +578,14 @@ BUILDIN(setq)
int quest_id = script_getnum(st, 2);
+ if (quest_id <= 0)
+ {
+ ShowError("Quest with id=%d is not valid\n", quest_id);
+ script->reportsrc(st);
+ st->state = END; // TERMINATE script execution
+ return false;
+ }
+
if (quest->check(sd, quest_id, HAVEQUEST) < 0)
quest->add(sd, quest_id, 0);
ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
@@ -587,7 +595,6 @@ BUILDIN(setq)
script->reportsrc(st);
return false;
}
- // TODO: If value is < 0, refuse and raise error
sd->quest_log[i].count[0] = max(0, script_getnum(st, 3));
if (script_hasdata(st, 4))