summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-04-30 00:21:56 -0500
committerWushin <pasekei@gmail.com>2015-04-30 00:21:56 -0500
commit575ab7156e5817fbce56551b3a7c4b7a37582280 (patch)
treec373e715b46026d8cb9bb4e6d633942e38d99c25
parent3dae56bb31632d87ad4a787491b8ef64facff25f (diff)
parentd05cda6da48aebb0e3513045e30c0f4136952e10 (diff)
downloadserverdata-575ab7156e5817fbce56551b3a7c4b7a37582280.tar.gz
serverdata-575ab7156e5817fbce56551b3a7c4b7a37582280.tar.bz2
serverdata-575ab7156e5817fbce56551b3a7c4b7a37582280.tar.xz
serverdata-575ab7156e5817fbce56551b3a7c4b7a37582280.zip
Merge pull request #352 from mekolat/humantime
do not accept negative values in humantime
-rw-r--r--world/map/npc/functions/time.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/world/map/npc/functions/time.txt b/world/map/npc/functions/time.txt
index 7d16a200..bd80a1b1 100644
--- a/world/map/npc/functions/time.txt
+++ b/world/map/npc/functions/time.txt
@@ -75,6 +75,7 @@ function|script|HumanTime
if(@seconds) set @ms, @ms + (@seconds * 1000);
if(@minutes) set @ms, @ms + (@minutes * 60000);
if(@days) set @ms, @ms + (@days * 1440000);
+ if(@ms < 0) goto L_TooShort;
if(@ms < 1000) goto L_Millis; // under 1 second we have nothing to count
set @seconds, @ms / 1000;
set @ms, @ms % 1000;
@@ -90,6 +91,10 @@ function|script|HumanTime
if(@days) goto L_Days;
goto L_Clean;
+L_TooShort:
+ debugmes "HumanTime: negative value: "+@ms;
+ mapexit;
+
L_Millis:
set @time$, @ms + "ms";
return;