Fix the previous patch by using emp_{s,}random() instead if {s,}rand48()

in src/lib/commands/{new,mfir}.c
This commit is contained in:
Marc Olzheim 2005-01-03 18:31:31 +00:00
parent de5ad66f07
commit 7cf3f0f6ca

View file

@ -61,14 +61,14 @@ Index: empserver/src/lib/commands/mfir.c
prb = (double)(range2 ? (trange / range2) : 1.0); prb = (double)(range2 ? (trange / range2) : 1.0);
prb *= prb; prb *= prb;
- srandom(time(NULL)); - srandom(time(NULL));
+ srand48(time(NULL)); + emp_srandom(time(NULL));
if (chance(prb)) { if (chance(prb)) {
pr("Wind deflects shell%s.\n", splur(shots)); pr("Wind deflects shell%s.\n", splur(shots));
/* dam = (int)((double)dam / 2.0);*/ /* dam = (int)((double)dam / 2.0);*/
dam = dam =
(int)((double)dam * (int)((double)dam *
- (double)((double)(90 - (random() % 11)) / - (double)((double)(90 - (random() % 11)) /
+ (double)((double)(90 - (rand48() % 11)) / + (double)((double)(90 - (emp_random() % 11)) /
100.0)); 100.0));
if (dam < 0) if (dam < 0)
dam = 0; dam = 0;
@ -80,13 +80,13 @@ Index: empserver/src/lib/commands/new.c
} }
} else { } else {
- srandom(time(NULL)); - srandom(time(NULL));
+ srand48(time(NULL)); + emp_srandom(time(NULL));
for (i = 0; i < 300 && !player->aborted; i++) { for (i = 0; i < 300 && !player->aborted; i++) {
/* Both x and y should be either odd or even */ /* Both x and y should be either odd or even */
- x = (random() % WORLD_X) - (WORLD_X / 2); - x = (random() % WORLD_X) - (WORLD_X / 2);
- y = (((random() % WORLD_Y) - (WORLD_Y / 2)) & ~1) | (x & 1); - y = (((random() % WORLD_Y) - (WORLD_Y / 2)) & ~1) | (x & 1);
+ x = (rand48() % WORLD_X) - (WORLD_X / 2); + x = (emp_random() % WORLD_X) - (WORLD_X / 2);
+ y = (((rand48() % WORLD_Y) - (WORLD_Y / 2)) & ~1) | (x & 1); + y = (((emp_random() % WORLD_Y) - (WORLD_Y / 2)) & ~1) | (x & 1);
/* /*
* If either of the two potential * If either of the two potential
* sanctuary sectors are already * sanctuary sectors are already