summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-07-26 16:06:44 +0200
committerGitHub <noreply@github.com>2020-07-26 16:06:44 +0200
commitee767bdd8dda20366451590a8c8a4af054d21b94 (patch)
tree4ca1144e6b4d3513991d5f9168b3e2a31fc08844 /src
parent060133ec08ed597cfcf105b5180ee77e8b89ea7a (diff)
parent45c296988f59b4030e5721c665e521378fd1e049 (diff)
downloadhercules-ee767bdd8dda20366451590a8c8a4af054d21b94.tar.gz
hercules-ee767bdd8dda20366451590a8c8a4af054d21b94.tar.bz2
hercules-ee767bdd8dda20366451590a8c8a4af054d21b94.tar.xz
hercules-ee767bdd8dda20366451590a8c8a4af054d21b94.zip
Merge pull request #2791 from Kenpachi2k13/gettimetick
Prevent overflow when using gettimetick(0)
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index b49844320..75582d72f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11272,7 +11272,8 @@ static BUILDIN(gettimetick)
case 0:
default:
//type 0:(System Ticks)
- script_pushint(st,(int)timer->gettick()); // TODO: change this to int64 when we'll support 64 bit script values
+ // Conjunction with INT_MAX is done to prevent overflow. (Script variables are signed integers.)
+ script_pushint(st, timer->gettick() & INT_MAX); // TODO: change this to int64 when we'll support 64 bit script values
break;
}
return true;