summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/script_buildins.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 4c43a26..97f6a29 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -587,14 +587,15 @@ BUILDIN(setq)
script->reportsrc(st);
return false;
}
+ // TODO: If value is < 0, refuse and raise error
- sd->quest_log[i].count[0] = script_getnum(st, 3);
+ sd->quest_log[i].count[0] = max(0, script_getnum(st, 3));
if (script_hasdata(st, 4))
- sd->quest_log[i].count[1] = script_getnum(st, 4);
+ sd->quest_log[i].count[1] = max(0, script_getnum(st, 4));
if (script_hasdata(st, 5))
- sd->quest_log[i].count[2] = script_getnum(st, 5);
+ sd->quest_log[i].count[2] = max(0, script_getnum(st, 5));
if (script_hasdata(st, 6))
- sd->quest_log[i].time = script_getnum(st, 6);
+ sd->quest_log[i].time = max(0, script_getnum(st, 6));
sd->save_quest = true;
if (map->save_settings & 64)
chrif->save(sd,0);