diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-08-03 20:05:30 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-08-03 20:05:30 -0300 |
commit | ceb3552310203d9053250bad72415a8fdc43d716 (patch) | |
tree | 6cbd8c5cc07f1d17a2e86a657926999f5b426323 | |
parent | 714d7cdf513628d76efcae99d76a61413e0cd550 (diff) | |
download | evol-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.c | 9 |
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)) |