eliminate even more static variable caches

This commit is contained in:
Enno Rehling 2015-11-22 16:14:27 +01:00
parent f7698d92a9
commit 2e392b4d7c
11 changed files with 58 additions and 101 deletions

View file

@ -77,7 +77,7 @@
"rules.blessed_harvest.flags": 1, "rules.blessed_harvest.flags": 1,
"rules.magic.elfpower": true, "rules.magic.elfpower": true,
"rules.magic.playerschools": "gwyrrd illaun draig cerddor", "rules.magic.playerschools": "gwyrrd illaun draig cerddor",
"rules.build.other_buildings": 1, "rules.build.other_buildings": true,
"rules.economy.taxation": 1, "rules.economy.taxation": 1,
"rules.food.flags": 2, "rules.food.flags": 2,
"rules.economy.roqf": 5, "rules.economy.roqf": 5,

View file

@ -3136,8 +3136,11 @@ static void peasant_taxes(region * r)
static bool rule_auto_taxation(void) static bool rule_auto_taxation(void)
{ {
int rule = config_get_int("rules.economy.taxation", 0); return config_get_int("rules.economy.taxation", 0) != 0;
return rule != 0; }
static bool rule_autowork(void) {
return config_get_int("work.auto", 0) != 0;
} }
void produce(struct region *r) void produce(struct region *r)
@ -3145,7 +3148,6 @@ void produce(struct region *r)
request workers[MAX_WORKERS]; request workers[MAX_WORKERS];
request *taxorders, *lootorders, *sellorders, *stealorders, *buyorders; request *taxorders, *lootorders, *sellorders, *stealorders, *buyorders;
unit *u; unit *u;
static int rule_autowork = -1;
bool limited = true; bool limited = true;
request *nextworker = workers; request *nextworker = workers;
assert(r); assert(r);
@ -3160,10 +3162,6 @@ void produce(struct region *r)
* *
* lehren vor lernen. */ * lehren vor lernen. */
if (rule_autowork < 0) {
rule_autowork = config_get_int("work.auto", 0);
}
assert(rmoney(r) >= 0); assert(rmoney(r) >= 0);
assert(rpeasants(r) >= 0); assert(rpeasants(r) >= 0);
@ -3237,7 +3235,7 @@ void produce(struct region *r)
break; break;
case K_WORK: case K_WORK:
if (!rule_autowork && do_work(u, u->thisorder, nextworker) == 0) { if (!rule_autowork() && do_work(u, u->thisorder, nextworker) == 0) {
assert(nextworker - workers < MAX_WORKERS); assert(nextworker - workers < MAX_WORKERS);
++nextworker; ++nextworker;
} }
@ -3282,7 +3280,7 @@ void produce(struct region *r)
* auszugeben bereit sind. */ * auszugeben bereit sind. */
if (entertaining) if (entertaining)
expandentertainment(r); expandentertainment(r);
if (!rule_autowork) { if (!rule_autowork()) {
expandwork(r, workers, nextworker, maxworkingpeasants(r)); expandwork(r, workers, nextworker, maxworkingpeasants(r));
} }
if (taxorders) if (taxorders)

View file

@ -685,7 +685,6 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
const char *btname; const char *btname;
order *new_order = NULL; order *new_order = NULL;
const struct locale *lang = u->faction->locale; const struct locale *lang = u->faction->locale;
static int rule_other = -1;
assert(u->number); assert(u->number);
assert(btype->construction); assert(btype->construction);
@ -749,10 +748,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
n = 1; n = 1;
} }
if (b) { if (b) {
if (rule_other < 0) { bool rule_other = config_get_int("rules.build.other_buildings", 1) != 0;
rule_other =
config_get_int("rules.build.other_buildings", 1);
}
if (!rule_other) { if (!rule_other) {
unit *owner = building_owner(b); unit *owner = building_owner(b);
if (!owner || owner->faction != u->faction) { if (!owner || owner->faction != u->faction) {

View file

@ -82,10 +82,7 @@ void terraform_resources(region * r)
{ {
int i; int i;
const terrain_type *terrain = r->terrain; const terrain_type *terrain = r->terrain;
static int terraform_all = -1; bool terraform_all = config_get_int("rules.terraform.all", 0) != 0;
if (terraform_all < 0) {
terraform_all = config_get_int("rules.terraform.all", 0);
}
if (terrain->production == NULL) if (terrain->production == NULL)
return; return;

View file

@ -1721,17 +1721,13 @@ void unit_addorder(unit * u, order * ord)
int unit_max_hp(const unit * u) int unit_max_hp(const unit * u)
{ {
static int rules_stamina = -1;
int h; int h;
double p; double p;
static const curse_type *heal_ct = NULL; static const curse_type *heal_ct = NULL;
int rule_stamina = config_get_int("rules.stamina", STAMINA_AFFECTS_HP);
if (rules_stamina < 0) {
rules_stamina = config_get_int("rules.stamina", STAMINA_AFFECTS_HP);
}
h = u_race(u)->hitpoints; h = u_race(u)->hitpoints;
if (rules_stamina & 1) { if (rule_stamina & 1) {
p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2; p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2;
h += (int)(h * p + 0.5); h += (int)(h * p + 0.5);
} }

View file

@ -118,7 +118,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
static bool RemoveNMRNewbie(void) static bool RemoveNMRNewbie(void)
{ {
int value = config_get_int("nmr.removenewbie", 0); int value = config_get_int("nmr.removenewbie", 0);
return value!=0; return value != 0;
} }
static void age_unit(region * r, unit * u) static void age_unit(region * r, unit * u)
@ -250,7 +250,7 @@ static double peasant_growth_factor(void)
#ifdef SLOWLUCK #ifdef SLOWLUCK
int peasant_luck_effect(int peasants, int luck, int maxp, double variance) { int peasant_luck_effect(int peasants, int luck, int maxp, double variance) {
int n, births=0; int n, births = 0;
double factor = peasant_growth_factor(); double factor = peasant_growth_factor();
for (n = peasants; n && luck; --n) { for (n = peasants; n && luck; --n) {
int chances = 0; int chances = 0;
@ -330,7 +330,7 @@ static void peasants(region * r)
* Großteil. dead kann nie größer als rpeasants(r) - satiated werden, * Großteil. dead kann nie größer als rpeasants(r) - satiated werden,
* so dass rpeasants(r) >= 0 bleiben muß. */ * so dass rpeasants(r) >= 0 bleiben muß. */
/* Es verhungert maximal die unterernährten Bevölkerung. */ /* Es verhungert maximal die unterernährten Bevölkerung. */
n = _min(peasants - satiated, rpeasants(r)); n = _min(peasants - satiated, rpeasants(r));
dead += (int)(0.5 + n * PEASANT_STARVATION_CHANCE); dead += (int)(0.5 + n * PEASANT_STARVATION_CHANCE);
@ -423,7 +423,7 @@ static void horses(region * r)
int i; int i;
double growth = double growth =
(RESOURCE_QUANTITY * HORSEGROWTH * 200 * (maxhorses - (RESOURCE_QUANTITY * HORSEGROWTH * 200 * (maxhorses -
horses)) / maxhorses; horses)) / maxhorses;
if (growth > 0) { if (growth > 0) {
if (a_find(r->attribs, &at_horseluck)) if (a_find(r->attribs, &at_horseluck))
@ -482,7 +482,7 @@ extern struct attrib_type at_germs;
static void static void
growing_trees_e3(region * r, const int current_season, growing_trees_e3(region * r, const int current_season,
const int last_weeks_season) const int last_weeks_season)
{ {
static const int transform[4][3] = { static const int transform[4][3] = {
{ -1, -1, 0 }, { -1, -1, 0 },
@ -751,7 +751,7 @@ void nmr_warnings(void)
if (msg == NULL) { if (msg == NULL) {
msg = msg =
msg_message("warn_dropout", "faction turns", f, msg_message("warn_dropout", "faction turns", f,
turn - f->lastorders); turn - f->lastorders);
} }
add_message(&fa->msgs, msg); add_message(&fa->msgs, msg);
} }
@ -785,12 +785,7 @@ void demographics(void)
/* die Nachfrage nach Produkten steigt. */ /* die Nachfrage nach Produkten steigt. */
struct demand *dmd; struct demand *dmd;
if (r->land) { if (r->land) {
static int plant_rules = -1; int plant_rules = config_get_int("rules.grow.formula", 0);
if (plant_rules < 0) {
plant_rules =
config_get_int("rules.grow.formula", 0);
}
for (dmd = r->land->demands; dmd; dmd = dmd->next) { for (dmd = r->land->demands; dmd; dmd = dmd->next) {
if (dmd->value > 0 && dmd->value < MAXDEMAND) { if (dmd->value > 0 && dmd->value < MAXDEMAND) {
float rise = DMRISE; float rise = DMRISE;
@ -988,11 +983,7 @@ static int mayboard(const unit * u, ship * sh)
static bool CheckOverload(void) static bool CheckOverload(void)
{ {
static int value = -1; return config_get_int("rules.check_overload", 0) != 0;
if (value < 0) {
value = config_get_int("rules.check_overload", 0);
}
return value != 0;
} }
int enter_ship(unit * u, struct order *ord, int id, bool report) int enter_ship(unit * u, struct order *ord, int id, bool report)
@ -1209,9 +1200,7 @@ int *age = NULL;
static void nmr_death(faction * f) static void nmr_death(faction * f)
{ {
static int rule = -1; int rule = config_get_int("rules.nmr.destroy", 0) != 0;
if (rule < 0)
rule = config_get_int("rules.nmr.destroy", 0);
if (rule) { if (rule) {
unit *u; unit *u;
for (u = f->units; u; u = u->nextF) { for (u = f->units; u; u = u->nextF) {
@ -1311,7 +1300,7 @@ int ally_cmd(unit * u, struct order *ord)
if (!s || !s[0]) { if (!s || !s[0]) {
keyword = P_ANY; keyword = P_ANY;
} }
else { else {
keyword = findparam(s, u->faction->locale); keyword = findparam(s, u->faction->locale);
} }
@ -1492,9 +1481,9 @@ int prefix_cmd(unit * u, struct order *ord)
if (fval(u, UFL_GROUP)) { if (fval(u, UFL_GROUP)) {
attrib *a = a_find(u->attribs, &at_group); attrib *a = a_find(u->attribs, &at_group);
if (a) { if (a) {
group *g = (group *)a->data.v; group *g = (group *)a->data.v;
ap = &g->attribs; ap = &g->attribs;
} }
} }
set_prefix(ap, race_prefixes[var.i]); set_prefix(ap, race_prefixes[var.i]);
} }
@ -1920,7 +1909,7 @@ deliverMail(faction * f, region * r, unit * u, const char *s, unit * receiver)
else { /* BOTSCHAFT an EINHEIT */ else { /* BOTSCHAFT an EINHEIT */
ADDMSG(&f->msgs, ADDMSG(&f->msgs,
msg_message("unitmessage", "region unit sender string", r, msg_message("unitmessage", "region unit sender string", r,
receiver, u, s)); receiver, u, s));
} }
} }
@ -2304,7 +2293,7 @@ static bool display_race(faction * f, unit * u, const race * rc)
/* hp_p : Trefferpunkte */ /* hp_p : Trefferpunkte */
bytes = bytes =
slprintf(bufp, size, " %d %s", rc->hitpoints, LOC(f->locale, slprintf(bufp, size, " %d %s", rc->hitpoints, LOC(f->locale,
"stat_hitpoints")); "stat_hitpoints"));
assert(bytes <= INT_MAX); assert(bytes <= INT_MAX);
if (wrptr(&bufp, &size, (int)bytes) != 0) if (wrptr(&bufp, &size, (int)bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
@ -2312,7 +2301,7 @@ static bool display_race(faction * f, unit * u, const race * rc)
/* b_attacke : Angriff */ /* b_attacke : Angriff */
bytes = bytes =
slprintf(bufp, size, ", %s: %d", LOC(f->locale, "stat_attack"), slprintf(bufp, size, ", %s: %d", LOC(f->locale, "stat_attack"),
(rc->at_default + rc->at_bonus)); (rc->at_default + rc->at_bonus));
assert(bytes <= INT_MAX); assert(bytes <= INT_MAX);
if (wrptr(&bufp, &size, (int)bytes) != 0) if (wrptr(&bufp, &size, (int)bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
@ -2320,7 +2309,7 @@ static bool display_race(faction * f, unit * u, const race * rc)
/* b_defense : Verteidigung */ /* b_defense : Verteidigung */
bytes = bytes =
slprintf(bufp, size, ", %s: %d", LOC(f->locale, "stat_defense"), slprintf(bufp, size, ", %s: %d", LOC(f->locale, "stat_defense"),
(rc->df_default + rc->df_bonus)); (rc->df_default + rc->df_bonus));
assert(bytes <= INT_MAX); assert(bytes <= INT_MAX);
if (wrptr(&bufp, &size, (int)bytes) != 0) if (wrptr(&bufp, &size, (int)bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
@ -2379,12 +2368,12 @@ static bool display_race(faction * f, unit * u, const race * rc)
case AT_STANDARD: case AT_STANDARD:
bytes = bytes =
(size_t)_snprintf(bufp, size, "%s (%s)", (size_t)_snprintf(bufp, size, "%s (%s)",
LOC(f->locale, "attack_standard"), rc->def_damage); LOC(f->locale, "attack_standard"), rc->def_damage);
break; break;
case AT_NATURAL: case AT_NATURAL:
bytes = bytes =
(size_t)_snprintf(bufp, size, "%s (%s)", (size_t)_snprintf(bufp, size, "%s (%s)",
LOC(f->locale, "attack_natural"), rc->attack[a].data.dice); LOC(f->locale, "attack_natural"), rc->attack[a].data.dice);
break; break;
case AT_SPELL: case AT_SPELL:
case AT_COMBATSPELL: case AT_COMBATSPELL:
@ -2396,7 +2385,7 @@ static bool display_race(faction * f, unit * u, const race * rc)
case AT_STRUCTURAL: case AT_STRUCTURAL:
bytes = bytes =
(size_t)_snprintf(bufp, size, "%s (%s)", (size_t)_snprintf(bufp, size, "%s (%s)",
LOC(f->locale, "attack_structural"), rc->attack[a].data.dice); LOC(f->locale, "attack_structural"), rc->attack[a].data.dice);
break; break;
default: default:
bytes = 0; bytes = 0;
@ -2500,7 +2489,7 @@ int promotion_cmd(unit * u, struct order *ord)
if (maxheroes(u->faction) < countheroes(u->faction) + u->number) { if (maxheroes(u->faction) < countheroes(u->faction) + u->number) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_feedback(u, ord, "heroes_maxed", "max count", msg_feedback(u, ord, "heroes_maxed", "max count",
maxheroes(u->faction), countheroes(u->faction))); maxheroes(u->faction), countheroes(u->faction)));
return 0; return 0;
} }
if (!valid_race(u->faction, u_race(u))) { if (!valid_race(u->faction, u_race(u))) {
@ -2745,7 +2734,8 @@ void sinkships(struct region * r)
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3); double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
damage_ship(sh, dmg); damage_ship(sh, dmg);
} }
} else if (!ship_owner(sh)) { }
else if (!ship_owner(sh)) {
// any ship lying around without an owner slowly rots // any ship lying around without an owner slowly rots
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05); double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
damage_ship(sh, dmg); damage_ship(sh, dmg);
@ -3280,14 +3270,14 @@ void new_units(void)
if (err == 1) { if (err == 1) {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_feedback(u, makeord, msg_feedback(u, makeord,
"too_many_units_in_alliance", "too_many_units_in_alliance",
"allowed", maxunits(u->faction))); "allowed", maxunits(u->faction)));
} }
else { else {
ADDMSG(&u->faction->msgs, ADDMSG(&u->faction->msgs,
msg_feedback(u, makeord, msg_feedback(u, makeord,
"too_many_units_in_faction", "too_many_units_in_faction",
"allowed", maxunits(u->faction))); "allowed", maxunits(u->faction)));
} }
ordp = &makeord->next; ordp = &makeord->next;
@ -3360,7 +3350,7 @@ void update_long_order(unit * u)
} }
// hungry units do not get long orders: // hungry units do not get long orders:
if (hunger) { if (hunger) {
if (u->old_orders) { if (u->old_orders) {
// keep looking for repeated orders that might clear the old_orders // keep looking for repeated orders that might clear the old_orders
continue; continue;
@ -3432,7 +3422,8 @@ void update_long_order(unit * u)
if (hunger) { if (hunger) {
// Hungernde Einheiten führen NUR den default-Befehl aus // Hungernde Einheiten führen NUR den default-Befehl aus
set_order(&u->thisorder, default_order(u->faction->locale)); set_order(&u->thisorder, default_order(u->faction->locale));
} else if (!exclusive) { }
else if (!exclusive) {
// Wenn die Einheit handelt oder zaubert, muss der Default-Befehl gelöscht werden. // Wenn die Einheit handelt oder zaubert, muss der Default-Befehl gelöscht werden.
set_order(&u->thisorder, NULL); set_order(&u->thisorder, NULL);
} }
@ -3459,7 +3450,7 @@ static int use_item(unit * u, const item_type * itype, int amount, struct order
return EUNUSABLE; return EUNUSABLE;
} }
result = itype->use ? itype->use(u, itype, amount, ord) : EUNUSABLE; result = itype->use ? itype->use(u, itype, amount, ord) : EUNUSABLE;
if (result>0) { if (result > 0) {
use_pooled(u, itype->rtype, GET_DEFAULT, result); use_pooled(u, itype->rtype, GET_DEFAULT, result);
} }
return result; return result;
@ -4543,7 +4534,7 @@ void update_subscriptions(void)
bool bool
cansee(const faction * f, const region * r, const unit * u, int modifier) cansee(const faction * f, const region * r, const unit * u, int modifier)
/* r kann != u->region sein, wenn es um Durchreisen geht, /* r kann != u->region sein, wenn es um Durchreisen geht,
* oder Zauber (sp_generous, sp_fetchastral). * oder Zauber (sp_generous, sp_fetchastral).
* Es muss auch niemand aus f in der region sein, wenn sie vom Turm * Es muss auch niemand aus f in der region sein, wenn sie vom Turm
* erblickt wird */ * erblickt wird */
@ -4645,10 +4636,10 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
bool bool
cansee_durchgezogen(const faction * f, const region * r, const unit * u, cansee_durchgezogen(const faction * f, const region * r, const unit * u,
int modifier) int modifier)
/* r kann != u->region sein, wenn es um durchreisen geht */ /* r kann != u->region sein, wenn es um durchreisen geht */
/* und es muss niemand aus f in der region sein, wenn sie vom Turm /* und es muss niemand aus f in der region sein, wenn sie vom Turm
* erblickt wird */ * erblickt wird */
{ {
int n; int n;
unit *u2; unit *u2;

View file

@ -215,15 +215,11 @@ static void free_mage(attrib * a)
bool FactionSpells(void) bool FactionSpells(void)
{ {
static int rules_factionspells = -1; return config_get_int("rules.magic.factionlist", 0) != 0;
if (rules_factionspells < 0) {
rules_factionspells = config_get_int("rules.magic.factionlist", 0);
}
return rules_factionspells!=0;
} }
void read_spells(struct quicklist **slistp, magic_t mtype, void read_spells(struct quicklist **slistp, magic_t mtype,
struct storage *store) struct storage *store)
{ {
for (;;) { for (;;) {
spell *sp; spell *sp;

View file

@ -962,10 +962,7 @@ static void demon_skillchanges(void)
if (fval(u, UFL_HUNGER)) { if (fval(u, UFL_HUNGER)) {
/* hungry demons only go down, never up in skill */ /* hungry demons only go down, never up in skill */
static int rule_hunger = -1; int rule_hunger = config_get_int("hunger.demon.skill", 0) != 0;
if (rule_hunger < 0) {
rule_hunger = config_get_int("hunger.demon.skill", 0);
}
if (rule_hunger) { if (rule_hunger) {
upchance = 0; upchance = 0;
downchance = 15; downchance = 15;
@ -1009,15 +1006,13 @@ static void icebergs(void)
} }
} }
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
#define HERBROTCHANCE 5 /* Verrottchance für Kräuter (ifdef HERBS_ROT) */
#ifdef HERBS_ROT #ifdef HERBS_ROT
static void rotting_herbs(void) static void rotting_herbs(void)
{ {
static int rule_rot = -1;
region *r; region *r;
int rule_rot = config_get_int("rules.economy.herbrot", HERBROTCHANCE);
if (rule_rot < 0) {
rule_rot = config_get_int("rules.economy.herbrot", HERBROTCHANCE);
}
if (rule_rot == 0) return; if (rule_rot == 0) return;
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {

View file

@ -42,14 +42,12 @@
/* experimental gameplay features (that don't affect the savefile) */ /* experimental gameplay features (that don't affect the savefile) */
/* TODO: move these settings to settings.h or into configuration files */ /* TODO: move these settings to settings.h or into configuration files */
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */ #define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
#define INSECT_POTION /* Spezialtrank für Insekten */ #define INSECT_POTION /* Spezialtrank für Insekten */
#define ORCIFICATION /* giving snotlings to the peasants gets counted */ #define ORCIFICATION /* giving snotlings to the peasants gets counted */
#define TREESIZE (8) /* space used by trees (in #peasants) */ #define TREESIZE (8) /* space used by trees (in #peasants) */
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */ #define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
#define HERBROTCHANCE 5 /* Verrottchance für Kräuter (ifdef HERBS_ROT) */
/* Gebäudegröße = Minimalbelagerer */ /* Gebäudegröße = Minimalbelagerer */
#define SIEGEFACTOR 2 #define SIEGEFACTOR 2

View file

@ -546,17 +546,10 @@ int study_cmd(unit * u, order * ord)
skill_t sk; skill_t sk;
int maxalchemy = 0; int maxalchemy = 0;
int speed_rule = (study_rule_t)config_get_int("study.speedup", 0); int speed_rule = (study_rule_t)config_get_int("study.speedup", 0);
static int learn_newskills = -1;
struct building *b = inside_building(u); struct building *b = inside_building(u);
const struct building_type *btype = building_is_active(b) ? b->type : NULL; const struct building_type *btype = building_is_active(b) ? b->type : NULL;
bool learn_newskills = config_get_int("study.newskills", 1) != 0;
if (learn_newskills < 0) {
const char *str = config_get("study.newskills");
if (str && strcmp(str, "false") == 0)
learn_newskills = 0;
else
learn_newskills = 1;
}
if (!unit_can_study(u)) { if (!unit_can_study(u)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_race_nolearn", "race", ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_race_nolearn", "race",
u_race(u))); u_race(u)));
@ -580,7 +573,7 @@ int study_cmd(unit * u, order * ord)
cmistake(u, ord, 771, MSG_EVENT); cmistake(u, ord, 771, MSG_EVENT);
return 0; return 0;
} }
if (learn_newskills == 0) { if (!learn_newskills) {
skill *sv = unit_skill(u, sk); skill *sv = unit_skill(u, sk);
if (sv == NULL) { if (sv == NULL) {
/* we can only learn skills we already have */ /* we can only learn skills we already have */

View file

@ -270,11 +270,8 @@ void get_food(region * r)
peasantfood = 0; peasantfood = 0;
} }
if (hungry > 0) { if (hungry > 0) {
static int demon_hunger = -1; bool demon_hunger = config_get_int("hunger.demons", 0) != 0;
if (demon_hunger < 0) { if (demon_hunger) {
demon_hunger = config_get_int("hunger.demons", 0);
}
if (demon_hunger == 0) {
/* demons who don't feed are hungry */ /* demons who don't feed are hungry */
if (hunger(hungry, u)) if (hunger(hungry, u))
fset(u, UFL_HUNGER); fset(u, UFL_HUNGER);