fix issue #477 (intermittent volcano)

This commit is contained in:
Enno Rehling 2017-01-23 11:44:34 +01:00
parent 2185e7d5e5
commit 6d9d920f81
2 changed files with 12 additions and 2 deletions

View File

@ -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()

View File

@ -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)