summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2023-10-29 19:11:32 -0300
committerJesusaves <cpntb1@ymail.com>2023-10-29 19:11:32 -0300
commitbc0a3f0204e0460548679421c511e517866d0371 (patch)
tree0b2540d8cee490bb256fc54bb43cae78e90c6b50
parent041c75cef4b75f1c6696a4b8fc702113366995d2 (diff)
downloadevol-hercules-bc0a3f0204e0460548679421c511e517866d0371.tar.gz
evol-hercules-bc0a3f0204e0460548679421c511e517866d0371.tar.bz2
evol-hercules-bc0a3f0204e0460548679421c511e517866d0371.tar.xz
evol-hercules-bc0a3f0204e0460548679421c511e517866d0371.zip
Reject updates from setq to negative values (it is unsigned int)
-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);