From 82782a1d6d37c714460888a040c94257a7d35542 Mon Sep 17 00:00:00 2001 From: copperwater Date: Wed, 31 Aug 2022 23:57:41 -0400 Subject: [PATCH] Make des.mineralize use default probabilities Calling des.mineralize() with no arguments was equivalent to calling it and manually specifying gem_prob = 0, gold_prob = 0, etc. Which meant that no mineralization would actually happen. Instead, make this match the intuitive behavior, and pass in -1 probabilities as defaults -- which the mineralize() function interprets as the caller wanting to use the standard probabilities for a level of that depth, as if it were not a special level. This change does not affect any special level files since des.mineralize is not currently used in any of them. --- src/sp_lev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index 60e5ee8ca..53f3460c1 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3782,10 +3782,11 @@ lspo_mineralize(lua_State *L) create_des_coder(); lcheck_param_table(L); - gem_prob = get_table_int_opt(L, "gem_prob", 0); - gold_prob = get_table_int_opt(L, "gold_prob", 0); - kelp_moat = get_table_int_opt(L, "kelp_moat", 0); - kelp_pool = get_table_int_opt(L, "kelp_pool", 0); + /* -1 produces default mineralize behavior */ + gem_prob = get_table_int_opt(L, "gem_prob", -1); + gold_prob = get_table_int_opt(L, "gold_prob", -1); + kelp_moat = get_table_int_opt(L, "kelp_moat", -1); + kelp_pool = get_table_int_opt(L, "kelp_pool", -1); mineralize(kelp_pool, kelp_moat, gold_prob, gem_prob, TRUE);