aboutsummaryrefslogtreecommitdiff
path: root/plugins/game/game.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/game/game.c')
-rw-r--r--plugins/game/game.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/game/game.c b/plugins/game/game.c
index cc6d21d..ef2651f 100644
--- a/plugins/game/game.c
+++ b/plugins/game/game.c
@@ -334,7 +334,9 @@ static void mapgen_set_air(int x, int y, enum mg_context ctx)
for (struct list *ptr = air_functions; ptr != NULL; ptr = ptr->next) {
struct generator_function *func = ptr->element;
- if (rand() % (ctx == MG_CTX_CORRIDOR ? func->corridor_chance : func->room_chance) == 0)
+ int chance = ctx == MG_CTX_CORRIDOR ? func->corridor_chance : func->room_chance;
+
+ if (chance && rand() % chance == 0)
func->callback(x, y, ctx);
}
}