projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replaced glib function calls to g_rand_*() and g_random_*()
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_caveengine.c
diff --git
a/src/game_bd/bd_caveengine.c
b/src/game_bd/bd_caveengine.c
index 080146c6ef35a21eb5925901cd65c40fa986e856..109bcb2da410e5e8d555a4ebc84ce3149de4cd99 100644
(file)
--- a/
src/game_bd/bd_caveengine.c
+++ b/
src/game_bd/bd_caveengine.c
@@
-1100,7
+1100,7
@@
static boolean do_push(GdCave *cave, int x, int y, GdDirection player_move, bool
}
if (is_space_dir(cave, x, y, GD_MV_TWICE + player_move) &&
}
if (is_space_dir(cave, x, y, GD_MV_TWICE + player_move) &&
- g_rand_int_range(cave->random, 0, 1000000) < prob)
+ g
d
_rand_int_range(cave->random, 0, 1000000) < prob)
{
/* if decided that he will be able to push, */
store_dir(cave, x, y, GD_MV_TWICE + player_move, what);
{
/* if decided that he will be able to push, */
store_dir(cave, x, y, GD_MV_TWICE + player_move, what);
@@
-1609,7
+1609,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
for (x = 0; x < cave->w; x++)
{
/* timer for the cell > 0? */
for (x = 0; x < cave->w; x++)
{
/* timer for the cell > 0? */
- if (cave->hammered_reappear[y][x]
>
0)
+ if (cave->hammered_reappear[y][x]
>
0)
{
/* decrease timer */
cave->hammered_reappear[y][x]--;
{
/* decrease timer */
cave->hammered_reappear[y][x]--;
@@
-2260,7
+2260,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
{
const GdDirection *creature_move;
boolean ccw = rotates_ccw(cave, x, y); /* check if default is counterclockwise */
{
const GdDirection *creature_move;
boolean ccw = rotates_ccw(cave, x, y); /* check if default is counterclockwise */
- GdElement base; /* base element number (which is like O_***_1) */
+ GdElement base
= -1
; /* base element number (which is like O_***_1) */
int dir, dirn, dirp; /* direction */
if (get(cave, x, y) >= O_FIREFLY_1 &&
int dir, dirn, dirp; /* direction */
if (get(cave, x, y) >= O_FIREFLY_1 &&
@@
-2279,7
+2279,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
get(cave, x, y) <= O_ALT_BUTTER_4)
base = O_ALT_BUTTER_1;
get(cave, x, y) <= O_ALT_BUTTER_4)
base = O_ALT_BUTTER_1;
- dir = get(cave, x, y)
-
base; /* facing where */
+ dir = get(cave, x, y)
-
base; /* facing where */
creature_move = cave->creatures_backwards ? creature_chdir : creature_dir;
/* now change direction if backwards */
creature_move = cave->creatures_backwards ? creature_chdir : creature_dir;
/* now change direction if backwards */
@@
-2337,7
+2337,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
{
int px = cave->px[0];
int py = cave->py[0];
{
int px = cave->px[0];
int py = cave->py[0];
- boolean horizontal = g_rand_boolean(cave->random);
+ boolean horizontal = g
d
_rand_boolean(cave->random);
boolean dont_move = FALSE;
int i = 3;
boolean dont_move = FALSE;
int i = 3;
@@
-2711,7
+2711,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
};
GdDirection random_dir;
};
GdDirection random_dir;
- random_dir = dirs[g_rand_int_range(cave->random, 0, G_N_ELEMENTS(dirs))];
+ random_dir = dirs[g
d
_rand_int_range(cave->random, 0, G_N_ELEMENTS(dirs))];
if (is_space_dir(cave, x, y, random_dir))
{
move(cave, x, y, random_dir, O_GHOST);
if (is_space_dir(cave, x, y, random_dir))
{
move(cave, x, y, random_dir, O_GHOST);
@@
-2756,9
+2756,9
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
/* if alive, check in which dir to grow (or not) */
if (cave->amoeba_state == GD_AM_AWAKE)
{
/* if alive, check in which dir to grow (or not) */
if (cave->amoeba_state == GD_AM_AWAKE)
{
- if (g_rand_int_range(cave->random, 0, 1000000) < cave->amoeba_growth_prob)
+ if (g
d
_rand_int_range(cave->random, 0, 1000000) < cave->amoeba_growth_prob)
{
{
- switch (g_rand_int_range(cave->random, 0, 4))
+ switch (g
d
_rand_int_range(cave->random, 0, 4))
{
/* decided to grow, choose a random direction. */
case 0: /* let this be up. numbers indifferent. */
{
/* decided to grow, choose a random direction. */
case 0: /* let this be up. numbers indifferent. */
@@
-2824,9
+2824,9
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
/* if it is alive, decide if it attempts to grow */
if (cave->amoeba_2_state == GD_AM_AWAKE)
/* if it is alive, decide if it attempts to grow */
if (cave->amoeba_2_state == GD_AM_AWAKE)
- if (g_rand_int_range(cave->random, 0, 1000000) < cave->amoeba_2_growth_prob)
+ if (g
d
_rand_int_range(cave->random, 0, 1000000) < cave->amoeba_2_growth_prob)
{
{
- switch (g_rand_int_range(cave->random, 0, 4))
+ switch (g
d
_rand_int_range(cave->random, 0, 4))
{
/* decided to grow, choose a random direction. */
case 0: /* let this be up. numbers indifferent. */
{
/* decided to grow, choose a random direction. */
case 0: /* let this be up. numbers indifferent. */
@@
-2857,7
+2857,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
case O_ACID:
/* choose randomly, if it spreads */
case O_ACID:
/* choose randomly, if it spreads */
- if (g_rand_int_range(cave->random, 0, 1000000) <= cave->acid_spread_ratio)
+ if (g
d
_rand_int_range(cave->random, 0, 1000000) <= cave->acid_spread_ratio)
{
/* the current one explodes */
store(cave, x, y, cave->acid_turns_to);
{
/* the current one explodes */
store(cave, x, y, cave->acid_turns_to);
@@
-2985,12
+2985,12
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
(rrr & cave->slime_permeability_c64) == 0);
#endif
/*
(rrr & cave->slime_permeability_c64) == 0);
#endif
/*
- * unpredictable: g_rand_int
+ * unpredictable: g
d
_rand_int
* predictable: c64 predictable random generator.
* for predictable, a random number is generated,
* whether or not it is even possible that the stone will be able to pass.
*/
* predictable: c64 predictable random generator.
* for predictable, a random number is generated,
* whether or not it is even possible that the stone will be able to pass.
*/
- if (cave->slime_predictable ? ((rrr /* XXX */ & cave->slime_permeability_c64) == 0) : g_rand_int_range(cave->random, 0, 1000000) < cave->slime_permeability)
+ if (cave->slime_predictable ? ((rrr /* XXX */ & cave->slime_permeability_c64) == 0) : g
d
_rand_int_range(cave->random, 0, 1000000) < cave->slime_permeability)
{
GdDirection grav = cave->gravity;
GdDirection oppos = opposite[cave->gravity];
{
GdDirection grav = cave->gravity;
GdDirection oppos = opposite[cave->gravity];
@@
-3201,7
+3201,7
@@
void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
O_WAITING_STONE, O_BITER_1
};
O_WAITING_STONE, O_BITER_1
};
- store(cave, x, y, ghost_explode[g_rand_int_range(cave->random, 0, G_N_ELEMENTS(ghost_explode))]);
+ store(cave, x, y, ghost_explode[g
d
_rand_int_range(cave->random, 0, G_N_ELEMENTS(ghost_explode))]);
}
break;
}
break;