From ed99f6018645d4868a20c8301a7b2615644b4d24 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 31 Mar 2017 21:37:30 +0200 Subject: [PATCH] decluttering settings.h --- src/attributes/attributes.c | 2 +- src/economy.c | 16 ---------------- src/kernel/faction.c | 26 ++------------------------ src/kernel/faction.h | 2 -- src/kernel/unit.c | 6 +++--- src/settings.h | 12 +----------- 6 files changed, 7 insertions(+), 57 deletions(-) diff --git a/src/attributes/attributes.c b/src/attributes/attributes.c index c4925b9c0..f699fdb57 100644 --- a/src/attributes/attributes.c +++ b/src/attributes/attributes.c @@ -102,7 +102,6 @@ void register_attributes(void) at_register(&at_group); at_register(&at_building_generic_type); - at_register(&at_maxmagicians); at_register(&at_npcfaction); /* connection-typen */ @@ -114,6 +113,7 @@ void register_attributes(void) at_register(&at_germs); + at_deprecate("maxmagicians", a_readint); /* factions with differnt magician limits, probably unused */ at_deprecate("hurting", a_readint); /* an old arena attribute */ at_deprecate("xontormiaexpress", a_readint); /* required for old datafiles */ at_deprecate("orcification", a_readint); /* required for old datafiles */ diff --git a/src/economy.c b/src/economy.c index 8a313a074..fa8d6aa22 100644 --- a/src/economy.c +++ b/src/economy.c @@ -480,7 +480,6 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders) gamedate date; get_gamedate(turn, &date); if (date.season == 0 && r->terrain != newterrain(T_DESERT)) { -#ifdef INSECT_POTION bool usepotion = false; unit *u2; @@ -490,7 +489,6 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders) break; } if (!usepotion) -#endif { cmistake(u, ord, 98, MSG_EVENT); return; @@ -2016,20 +2014,6 @@ static void expandstealing(region * r, request * stealorders) if (u && u->region == r) { n = get_pooled(u, rsilver, GET_ALL, INT_MAX); } -#ifndef GOBLINKILL - if (oa[i].type.goblin) { /* Goblin-Spezialklau */ - int uct = 0; - unit *u2; - assert(effskill(oa[i].unit, SK_STEALTH) >= 4 - || !"this goblin\'s skill is too low"); - for (u2 = r->units; u2; u2 = u2->next) { - if (u2->faction == u->faction) { - uct += maintenance_cost(u2); - } - } - n -= uct * 2; - } -#endif if (n > 10 && rplane(r) && (rplane(r)->flags & PFL_NOALLIANCES)) { /* In Questen nur reduziertes Klauen */ n = 10; diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 03cea282f..ae60ce439 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -644,7 +644,7 @@ int skill_limit(faction * f, skill_t sk) m = max_magicians(f); } else if (sk == SK_ALCHEMY) { - m = config_get_int("rules.maxskills.alchemy", MAXALCHEMISTS); + m = config_get_int("rules.maxskills.alchemy", 3); } return m; } @@ -752,22 +752,6 @@ int count_maxmigrants(const faction * f) return 0; } -static void init_maxmagicians(struct attrib *a) -{ - a->data.i = MAXMAGICIANS; -} - -attrib_type at_maxmagicians = { - "maxmagicians", - init_maxmagicians, - NULL, - NULL, - a_writeint, - a_readint, - NULL, - ATF_UNIQUE -}; - int max_magicians(const faction * f) { static int rule, config, rc_cache; @@ -775,15 +759,9 @@ int max_magicians(const faction * f) int m; if (config_changed(&config)) { - rule = config_get_int("rules.maxskills.magic", MAXMAGICIANS); + rule = config_get_int("rules.maxskills.magic", 3); } m = rule; - if (f->attribs) { - attrib *a = a_find(f->attribs, &at_maxmagicians); - if (a) { - m = a->data.i; - } - } if (rc_changed(&rc_cache)) { rc_elf = get_race(RC_ELF); } diff --git a/src/kernel/faction.h b/src/kernel/faction.h index c6afc767c..edd812bf0 100644 --- a/src/kernel/faction.h +++ b/src/kernel/faction.h @@ -35,8 +35,6 @@ extern "C" { struct gamedata; struct selist; - extern struct attrib_type at_maxmagicians; - /* faction flags */ #define FFL_NEWID (1<<0) /* Die Partei hat bereits einmal ihre no gewechselt */ #define FFL_ISNEW (1<<1) diff --git a/src/kernel/unit.c b/src/kernel/unit.c index ddc8e0e4a..9dbfbfe0e 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1724,13 +1724,13 @@ int unit_max_hp(const unit * u) int h; double p; static int config; - static int rule_stamina; + static bool rule_stamina; h = u_race(u)->hitpoints; if (config_changed(&config)) { - rule_stamina = config_get_int("rules.stamina", STAMINA_AFFECTS_HP); + rule_stamina = config_get_int("rules.stamina", 1)!=0; } - if (rule_stamina & 1) { + if (rule_stamina) { p = pow(effskill(u, SK_STAMINA, u->region) / 2.0, 1.5) * 0.2; h += (int)(h * p + 0.5); } diff --git a/src/settings.h b/src/settings.h index 72e179738..e8693a763 100644 --- a/src/settings.h +++ b/src/settings.h @@ -30,23 +30,13 @@ */ #define MUSEUM_MODULE 1 - /* experimental gameplay features (that don't affect the savefile) */ /* TODO: move these settings to settings.h or into configuration files */ -#define GOBLINKILL /* Goblin-Spezialklau kann toedlich enden */ -#define INSECT_POTION /* Spezialtrank fuer Insekten */ - #define TREESIZE (8) /* space used by trees (in #peasants) */ - #define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */ - /* Gebaeudegroesse = Minimalbelagerer */ +/* Gebaeudegroesse = Minimalbelagerer */ #define SIEGEFACTOR 2 - /** Magic */ -#define MAXMAGICIANS 3 -#define MAXALCHEMISTS 3 - #define ENCCHANCE 10 /* %-Chance fuer einmalige Zufallsbegegnung */ #define BAGCAPACITY 20000 /* soviel passt in einen Bag of Holding */ #define PERSON_WEIGHT 1000 /* weight of a "normal" human unit */ -#define STAMINA_AFFECTS_HP 1<<0