summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorgepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-17 18:06:34 +0000
committergepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-17 18:06:34 +0000
commit95548cb1caad95933e2b36df9a13af070b733b04 (patch)
treeb9ce67cc8b45c6956528e5bb2935900b6d8ad441 /src/map/atcommand.c
parenta09cc2371ac0a2534f514a35a5637614c11f6a37 (diff)
downloadhercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.gz
hercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.bz2
hercules-95548cb1caad95933e2b36df9a13af070b733b04.tar.xz
hercules-95548cb1caad95933e2b36df9a13af070b733b04.zip
Enabled Mersenne Twister MT19937 as random number generator instead of standard `rand()` function (follow-up to r14865, r14870).
- It fixes issues caused by RAND_MAX being only 32k in Windows system (bugreport:1927, bugreport:86). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15483 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 78cd7a6a9..d4353a5ab 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -8,6 +8,7 @@
#include "../common/core.h"
#include "../common/showmsg.h"
#include "../common/malloc.h"
+#include "../common/random.h"
#include "../common/socket.h"
#include "../common/strlib.h"
#include "../common/utils.h"
@@ -2600,11 +2601,11 @@ ACMD_FUNC(monstersmall)
for (i = 0; i < number; i++) {
int mx, my;
if (x <= 0)
- mx = sd->bl.x + (rand() % 11 - 5);
+ mx = sd->bl.x + (rnd() % 11 - 5);
else
mx = x;
if (y <= 0)
- my = sd->bl.y + (rand() % 11 - 5);
+ my = sd->bl.y + (rnd() % 11 - 5);
else
my = y;
count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "2") != 0) ? 1 : 0;
@@ -2676,11 +2677,11 @@ ACMD_FUNC(monsterbig)
for (i = 0; i < number; i++) {
int mx, my;
if (x <= 0)
- mx = sd->bl.x + (rand() % 11 - 5);
+ mx = sd->bl.x + (rnd() % 11 - 5);
else
mx = x;
if (y <= 0)
- my = sd->bl.y + (rand() % 11 - 5);
+ my = sd->bl.y + (rnd() % 11 - 5);
else
my = y;
count += (mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "4") != 0) ? 1 : 0;
@@ -5137,7 +5138,7 @@ ACMD_FUNC(jail)
return -1;
}
- switch(rand() % 2) { //Jail Locations
+ switch(rnd() % 2) { //Jail Locations
case 0:
m_index = mapindex_name2id(MAP_JAIL);
x = 24;
@@ -5291,7 +5292,7 @@ ACMD_FUNC(jailfor)
}
//Jail locations, add more as you wish.
- switch(rand()%2)
+ switch(rnd()%2)
{
case 1: //Jail #1
m_index = mapindex_name2id(MAP_JAIL);
@@ -8257,8 +8258,8 @@ ACMD_FUNC(clone)
}
do {
- x = sd->bl.x + (rand() % 10 - 5);
- y = sd->bl.y + (rand() % 10 - 5);
+ x = sd->bl.x + (rnd() % 10 - 5);
+ y = sd->bl.y + (rnd() % 10 - 5);
} while (map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {