summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-13 17:31:31 +0000
committerepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-13 17:31:31 +0000
commitbbf2587c481b098a3dfbeed091dfa90a88e0bc06 (patch)
tree03432a27689cc03343b38e05171a33b96a7d3a51 /src
parent1ce9e472f8a40b141450845f9e7e0deff514f175 (diff)
downloadhercules-bbf2587c481b098a3dfbeed091dfa90a88e0bc06.tar.gz
hercules-bbf2587c481b098a3dfbeed091dfa90a88e0bc06.tar.bz2
hercules-bbf2587c481b098a3dfbeed091dfa90a88e0bc06.tar.xz
hercules-bbf2587c481b098a3dfbeed091dfa90a88e0bc06.zip
- Fixed rand() script command not allowing a range of over 32767 on several systems
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15090 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index c9cb65f63..6b051dba0 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4448,6 +4448,10 @@ BUILDIN_FUNC(rand)
}
if( range <= 1 )
script_pushint(st, min);
+ else if( range > SHRT_MAX ) {
+ int step1 = rand()%(range&0xffff), step2 = rand()%(range>>16);
+ script_pushint(st, step1 + (step2<<16) + min);
+ }
else
script_pushint(st, rand()%range + min);