- Fixed rand() script command not allowing a range of over 32767 on several systems
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15090 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
642584042e
commit
9d32a824b5
@ -4448,6 +4448,10 @@ BUILDIN_FUNC(rand)
|
|||||||
}
|
}
|
||||||
if( range <= 1 )
|
if( range <= 1 )
|
||||||
script_pushint(st, min);
|
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
|
else
|
||||||
script_pushint(st, rand()%range + min);
|
script_pushint(st, rand()%range + min);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user