diff --git a/src/battle.c b/src/battle.c index 1ad811c9f..d35110b4e 100644 --- a/src/battle.c +++ b/src/battle.c @@ -2532,12 +2532,9 @@ troop select_ally(fighter * af, int minrow, int maxrow, int allytype) static int loot_quota(const unit * src, const unit * dst, const item_type * type, int n) { - static double divisor = -1; if (dst && src && src->faction != dst->faction) { - if (divisor < 0) { - divisor = config_get_flt("rules.items.loot_divisor", 1); - assert(divisor == 0 || divisor >= 1); - } + double divisor = config_get_flt("rules.items.loot_divisor", 1); + assert(divisor == 0 || divisor >= 1); if (divisor >= 1) { double r = n / divisor; int x = (int)r; diff --git a/src/kernel/resources.c b/src/kernel/resources.c index 3ffad7491..658445c69 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -29,12 +29,7 @@ static double ResourceFactor(void) { - static double value = -1.0; - if (value < 0) { - const char *str = config_get("resource.factor"); - value = str ? atof(str) : 1.0; - } - return value; + return config_get_flt("resource.factor", 1.0); } void update_resources(region * r) diff --git a/src/laws.c b/src/laws.c index a53dfe31b..6b0ce3d35 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3465,7 +3465,8 @@ static int use_item(unit * u, const item_type * itype, int amount, struct order static double heal_factor(const unit * u) { - static double elf_regen = -1; + double elf_regen; + switch (old_race(u_race(u))) { case RC_TROLL: case RC_DAEMON: @@ -3473,8 +3474,7 @@ static double heal_factor(const unit * u) case RC_GOBLIN: return 2.0; case RC_ELF: - if (elf_regen < 0) - elf_regen = get_param_flt(u_race(u)->parameters, "regen.forest", 1.0F); + elf_regen = get_param_flt(u_race(u)->parameters, "regen.forest", 1.0F); if (elf_regen != 1.0 && r_isforest(u->region)) { return elf_regen; } diff --git a/src/magic.c b/src/magic.c index e1eccbe05..510240a74 100644 --- a/src/magic.c +++ b/src/magic.c @@ -108,14 +108,9 @@ attrib_type at_reportspell = { ** TODO: separate castle-appearance from illusion-effects **/ -static float MagicRegeneration(void) +static double MagicRegeneration(void) { - static float value = -1.0; - if (value < 0) { - const char *str = config_get("magic.regeneration"); - value = str ? (float)atof(str) : 1.0F; - } - return value; + return config_get_flt("magic.regeneration", 1.0); } static double MagicPower(double force) diff --git a/src/move.c b/src/move.c index 3a3d91d83..5117b7f6a 100644 --- a/src/move.c +++ b/src/move.c @@ -700,11 +700,7 @@ static void set_coast(ship * sh, region * r, region * rnext) static float damage_drift(void) { - static float value = -1.0F; - if (value < 0) { - value = (float)config_get_flt("rules.ship.damage_drift", 0.02F); - } - return value; + return (float)config_get_flt("rules.ship.damage_drift", 0.02); } static void drifting_ships(region * r)