From ceb3552310203d9053250bad72415a8fdc43d716 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 3 Aug 2024 20:05:30 -0300 Subject: setq with illegal quest <= 0: Abort script execution, report error --- src/emap/script_buildins.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3-70-g09d2