diff options
Diffstat (limited to 'src/emap/script_buildins.c')
-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)) |