summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-08-29 20:43:53 -0400
committerMadCamel <madcamel@gmail.com>2009-08-29 20:45:59 -0400
commit837194519b2be29aa7665828e4d7cb8035fe1c3b (patch)
tree6aefce861fe537c58a585c5ec6e353331891e1ba /src/map/map.c
parentde294e7c7d5ccf129eea3ce45c8023fa7b6d371d (diff)
downloadtmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.gz
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.bz2
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.tar.xz
tmwa-837194519b2be29aa7665828e4d7cb8035fe1c3b.zip
Converted to Mersenne Twister for random.
Randomerer! Also: Fixed a security problem. Can you find it?
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 86acb62..b3f9dd5 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -709,7 +709,7 @@ int map_searchrandfreecell(int m,int x,int y,int range) {
}
if(free_cell==0)
return -1;
- free_cell=rand()%free_cell;
+ free_cell=MRAND(free_cell);
for(i=-range;i<=range;i++){
if(i+y<0 || i+y>=map[m].ys)
continue;
@@ -750,7 +750,7 @@ int map_addflooritem_any(struct item *item_data, int amount, int m, int x, int y
if((xy=map_searchrandfreecell(m,x,y, dispersal))<0)
return 0;
- r=rand();
+ r=mt_random();
fitem = (struct flooritem_data *)aCalloc(1,sizeof(*fitem));
fitem->bl.type=BL_ITEM;
@@ -1833,8 +1833,6 @@ int do_init(int argc, char *argv[]) {
unsigned char *MSG_CONF_NAME = "conf/msg_athena.conf";
unsigned char *GRF_PATH_FILENAME = "conf/grf-files.txt";
- srand(gettick());
-
for (i = 1; i < argc ; i++) {
if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "--h") == 0 || strcmp(argv[i], "--?") == 0 || strcmp(argv[i], "/?") == 0)