diff --git a/scripts/tests/xmas.lua b/scripts/tests/xmas.lua index 7ac4ce731..5477e08ab 100644 --- a/scripts/tests/xmas.lua +++ b/scripts/tests/xmas.lua @@ -8,6 +8,8 @@ function setup() eressea.settings.set("rules.grow.formula", "0") eressea.settings.set("rules.peasants.growth.factor", "0") eressea.settings.set("volcano.active.percent", "0") + eressea.settings.set("volcano.outbreak.percent", "0") + eressea.settings.set("volcano.stop.percent", "0") end function test_snowglobe_fail() diff --git a/src/volcano.c b/src/volcano.c index a9a4f0ba7..89a865017 100644 --- a/src/volcano.c +++ b/src/volcano.c @@ -256,11 +256,19 @@ void volcano_outbreak(region * r, region *rn) } static bool stop_smoke_chance(void) { - return rng_int() % 100 < 12; + static int cache, percent = 0; + if (config_changed(&cache)) { + percent = config_get_int("volcano.stop.percent", 12); + } + return percent!=0 && (rng_int() % 100) < percent; } static bool outbreak_chance(void) { - return rng_int() % 100 < 8; + static int cache, percent = 0; + if (config_changed(&cache)) { + percent = config_get_int("volcano.outbreak.percent", 8); + } + return percent!=0 && (rng_int() % 100) < percent; } void volcano_update(void)