forked from github/server
replace all get_param_* for global.parameters with config_get_*
This commit is contained in:
parent
b05fe9316a
commit
a4cb5e2906
27 changed files with 127 additions and 146 deletions
36
src/battle.c
36
src/battle.c
|
@ -136,26 +136,26 @@ static int skill_formula = 0;
|
|||
static void static_rules(void)
|
||||
{
|
||||
loot_rules =
|
||||
get_param_int(global.parameters, "rules.combat.loot",
|
||||
config_get_int("rules.combat.loot",
|
||||
LOOT_MONSTERS | LOOT_OTHERS | LOOT_KEEPLOOT);
|
||||
/* new formula to calculate to-hit-chance */
|
||||
skill_formula =
|
||||
get_param_int(global.parameters, "rules.combat.skill_formula",
|
||||
config_get_int("rules.combat.skill_formula",
|
||||
FORMULA_ORIG);
|
||||
/* maximum number of combat turns */
|
||||
max_turns =
|
||||
get_param_int(global.parameters, "rules.combat.turns", COMBAT_TURNS);
|
||||
config_get_int("rules.combat.turns", COMBAT_TURNS);
|
||||
/* damage calculation */
|
||||
if (get_param_int(global.parameters, "rules.combat.critical", 1)) {
|
||||
if (config_get_int("rules.combat.critical", 1)) {
|
||||
damage_rules |= DAMAGE_CRITICAL;
|
||||
}
|
||||
if (get_param_int(global.parameters, "rules.combat.melee_bonus", 1)) {
|
||||
if (config_get_int("rules.combat.melee_bonus", 1)) {
|
||||
damage_rules |= DAMAGE_MELEE_BONUS;
|
||||
}
|
||||
if (get_param_int(global.parameters, "rules.combat.missile_bonus", 1)) {
|
||||
if (config_get_int("rules.combat.missile_bonus", 1)) {
|
||||
damage_rules |= DAMAGE_MISSILE_BONUS;
|
||||
}
|
||||
if (get_param_int(global.parameters, "rules.combat.skill_bonus", 1)) {
|
||||
if (config_get_int("rules.combat.skill_bonus", 1)) {
|
||||
damage_rules |= DAMAGE_SKILL_BONUS;
|
||||
}
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ static int CavalrySkill(void)
|
|||
static int skill = -1;
|
||||
|
||||
if (skill < 0) {
|
||||
skill = get_param_int(global.parameters, "rules.cavalry.skill", 2);
|
||||
skill = config_get_int("rules.cavalry.skill", 2);
|
||||
}
|
||||
return skill;
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ static int CavalryBonus(const unit * u, troop enemy, int type)
|
|||
static int mode = -1;
|
||||
|
||||
if (mode < 0) {
|
||||
mode = get_param_int(global.parameters, "rules.cavalry.mode", 1);
|
||||
mode = config_get_int("rules.cavalry.mode", 1);
|
||||
}
|
||||
if (mode == 0) {
|
||||
/* old rule, Eressea 1.0 compat */
|
||||
|
@ -1008,7 +1008,7 @@ static void vampirism(troop at, int damage)
|
|||
{
|
||||
static int vampire = -1;
|
||||
if (vampire < 0)
|
||||
vampire = get_param_int(global.parameters, "rules.combat.demon_vampire", 0);
|
||||
vampire = config_get_int("rules.combat.demon_vampire", 0);
|
||||
if (vampire > 0) {
|
||||
int gain = damage / vampire;
|
||||
int chance = damage - vampire * gain;
|
||||
|
@ -1108,7 +1108,7 @@ int calculate_armor(troop dt, const weapon_type *dwtype, const weapon_type *awty
|
|||
am = select_magicarmor(dt);
|
||||
|
||||
if (rule_armor < 0) {
|
||||
rule_armor = get_param_int(global.parameters, "rules.combat.nat_armor", 0);
|
||||
rule_armor = config_get_int("rules.combat.nat_armor", 0);
|
||||
}
|
||||
if (rule_armor == 0) {
|
||||
/* natürliche Rüstung ist halbkumulativ */
|
||||
|
@ -1616,7 +1616,7 @@ static troop select_opponent(battle * b, troop at, int mindist, int maxdist)
|
|||
|
||||
if (tactics_formula < 0) {
|
||||
tactics_formula =
|
||||
get_param_int(global.parameters, "rules.tactics.formula", 0);
|
||||
config_get_int("rules.tactics.formula", 0);
|
||||
}
|
||||
if (tactics_formula == 1) {
|
||||
int tactics = get_tactics(at.fighter->side, dt.fighter->side);
|
||||
|
@ -1942,7 +1942,7 @@ int skilldiff(troop at, troop dt, int dist)
|
|||
static int goblin_bonus = -1;
|
||||
if (goblin_bonus < 0)
|
||||
goblin_bonus =
|
||||
get_param_int(global.parameters, "rules.combat.goblinbonus", 10);
|
||||
config_get_int("rules.combat.goblinbonus", 10);
|
||||
if (af->side->size[SUM_ROW] >= df->side->size[SUM_ROW] * goblin_bonus) {
|
||||
skdiff += 1;
|
||||
}
|
||||
|
@ -2142,7 +2142,7 @@ static void make_heroes(battle * b)
|
|||
side *s;
|
||||
static int hero_speed = 0;
|
||||
if (hero_speed == 0) {
|
||||
hero_speed = get_param_int(global.parameters, "rules.combat.herospeed", 10);
|
||||
hero_speed = config_get_int("rules.combat.herospeed", 10);
|
||||
}
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
fighter *fig;
|
||||
|
@ -2546,7 +2546,7 @@ static int loot_quota(const unit * src, const unit * dst,
|
|||
static double divisor = -1;
|
||||
if (dst && src && src->faction != dst->faction) {
|
||||
if (divisor < 0) {
|
||||
divisor = get_param_flt(global.parameters, "rules.items.loot_divisor", 1);
|
||||
divisor = config_get_flt("rules.items.loot_divisor", 1);
|
||||
assert(divisor == 0 || divisor >= 1);
|
||||
}
|
||||
if (divisor >= 1) {
|
||||
|
@ -2654,7 +2654,7 @@ static double PopulationDamage(void)
|
|||
static double value = -1.0;
|
||||
if (value < 0) {
|
||||
int damage =
|
||||
get_param_int(global.parameters, "rules.combat.populationdamage",
|
||||
config_get_int("rules.combat.populationdamage",
|
||||
BATTLE_KILLS_PEASANTS);
|
||||
value = damage / 100.0;
|
||||
}
|
||||
|
@ -2908,7 +2908,7 @@ static void aftermath(battle * b)
|
|||
int n = b->turn - 2;
|
||||
if (n > 0) {
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.battleround",
|
||||
config_get_flt("rules.ship.damage.battleround",
|
||||
0.05F);
|
||||
damage_ship(sh, dmg * n);
|
||||
freset(sh, SF_DAMAGED);
|
||||
|
@ -3216,7 +3216,7 @@ side * find_side(battle * b, const faction * f, const group * g, unsigned int fl
|
|||
static int rule_anon_battle = -1;
|
||||
|
||||
if (rule_anon_battle < 0) {
|
||||
rule_anon_battle = get_param_int(global.parameters, "rules.stealth.anon_battle", 1);
|
||||
rule_anon_battle = config_get_int("rules.stealth.anon_battle", 1);
|
||||
}
|
||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||
if (s->faction == f && s->group == g) {
|
||||
|
|
|
@ -1006,7 +1006,7 @@ static void parse_inifile(lua_State * L, dictionary * d, const char *section)
|
|||
lua_pushstring(L, "reportpath");
|
||||
lua_pushstring(L, reportpath());
|
||||
lua_rawset(L, -3);
|
||||
arg = get_param(global.parameters, "config.rules");
|
||||
arg = config_get("config.rules");
|
||||
if (arg) {
|
||||
lua_pushstring(L, "rules");
|
||||
lua_pushstring(L, arg);
|
||||
|
|
|
@ -193,7 +193,7 @@ static void chaos(region * r)
|
|||
while (sh) {
|
||||
ship *nsh = sh->next;
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.atlantis",
|
||||
config_get_flt("rules.ship.damage.atlantis",
|
||||
0.50);
|
||||
damage_ship(sh, dmg);
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
|
|
|
@ -1505,7 +1505,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
|
|||
FILE *F = fopen(filename, "wt");
|
||||
|
||||
if (era < 0) {
|
||||
era = get_param_int(global.parameters, "world.era", 1);
|
||||
era = config_get_int("world.era", 1);
|
||||
}
|
||||
if (F == NULL) {
|
||||
perror(filename);
|
||||
|
|
|
@ -104,7 +104,7 @@ static void recruit_init(void)
|
|||
{
|
||||
if (rules_recruit < 0) {
|
||||
rules_recruit = 0;
|
||||
if (get_param_int(global.parameters, "recruit.allow_merge", 1)) {
|
||||
if (config_get_int("recruit.allow_merge", 1)) {
|
||||
rules_recruit |= RECRUIT_MERGE;
|
||||
}
|
||||
}
|
||||
|
@ -2745,11 +2745,11 @@ void entertain_cmd(unit * u, struct order *ord)
|
|||
kwd = init_order(ord);
|
||||
assert(kwd == K_ENTERTAIN);
|
||||
if (!entertainbase) {
|
||||
const char *str = get_param(global.parameters, "entertain.base");
|
||||
const char *str = config_get("entertain.base");
|
||||
entertainbase = str ? atoi(str) : 0;
|
||||
}
|
||||
if (!entertainperlevel) {
|
||||
const char *str = get_param(global.parameters, "entertain.perlevel");
|
||||
const char *str = config_get("entertain.perlevel");
|
||||
entertainperlevel = str ? atoi(str) : 0;
|
||||
}
|
||||
if (fval(u, UFL_WERE)) {
|
||||
|
@ -3020,7 +3020,7 @@ void loot_cmd(unit * u, struct order *ord, request ** lootorders)
|
|||
kwd = init_order(ord);
|
||||
assert(kwd == K_LOOT);
|
||||
|
||||
if (get_param_int(global.parameters, "rules.enable_loot", 0) == 0 && !is_monsters(u->faction)) {
|
||||
if (config_get_int("rules.enable_loot", 0) == 0 && !is_monsters(u->faction)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3136,7 +3136,7 @@ static void peasant_taxes(region * r)
|
|||
|
||||
static bool rule_auto_taxation(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.economy.taxation", 0);
|
||||
int rule = config_get_int("rules.economy.taxation", 0);
|
||||
return rule != 0;
|
||||
}
|
||||
|
||||
|
@ -3161,7 +3161,7 @@ void produce(struct region *r)
|
|||
* lehren vor lernen. */
|
||||
|
||||
if (rule_autowork < 0) {
|
||||
rule_autowork = get_param_int(global.parameters, "work.auto", 0);
|
||||
rule_autowork = config_get_int("work.auto", 0);
|
||||
}
|
||||
|
||||
assert(rmoney(r) >= 0);
|
||||
|
|
|
@ -52,12 +52,12 @@
|
|||
#define RESERVE_GIVE /* reserve anything that's given from one unit to another? */
|
||||
|
||||
static int max_transfers(void) {
|
||||
return get_param_int(global.parameters, "rules.give.max_men", 5);
|
||||
return config_get_int("rules.give.max_men", 5);
|
||||
}
|
||||
|
||||
static int GiveRestriction(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "GiveRestriction", 0);
|
||||
return config_get_int("GiveRestriction", 0);
|
||||
}
|
||||
|
||||
static void feedback_give_not_allowed(unit * u, order * ord)
|
||||
|
@ -132,7 +132,7 @@ int give_quota(const unit * src, const unit * dst, const item_type * type,
|
|||
return n;
|
||||
}
|
||||
if (dst && src && src->faction != dst->faction) {
|
||||
divisor = get_param_flt(global.parameters, "rules.items.give_divisor", 1);
|
||||
divisor = config_get_flt("rules.items.give_divisor", 1);
|
||||
assert(divisor == 0 || divisor >= 1);
|
||||
if (divisor >= 1) {
|
||||
/* predictable > correct: */
|
||||
|
@ -235,7 +235,7 @@ static bool can_give_men(const unit *u, order *ord, message **msg) {
|
|||
|
||||
static bool rule_transfermen(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.transfermen", 1);
|
||||
int rule = config_get_int("rules.transfermen", 1);
|
||||
return rule != 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,13 +141,11 @@ int *casualties)
|
|||
d += terminate(dt, *at, AT_STANDARD, wp->type->damage[0], true);
|
||||
#ifdef CATAPULT_STRUCTURAL_DAMAGE
|
||||
if (dt.fighter->unit->building && rng_int() % 100 < 5) {
|
||||
float dmg =
|
||||
get_param_flt(global.parameters, "rules.building.damage.catapult", 1);
|
||||
double dmg = config_get_flt("rules.building.damage.catapult", 1);
|
||||
damage_building(b, dt.fighter->unit->building, dmg);
|
||||
}
|
||||
else if (dt.fighter->unit->ship && rng_int() % 100 < 5) {
|
||||
float dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.catapult", 0.01);
|
||||
double dmg = config_get_flt("rules.ship.damage.catapult", 0.01);
|
||||
damage_ship(dt.fighter->unit->ship, dmg)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@ static void coor_from_tiled(int *x, int *y) {
|
|||
|
||||
static int report_json(const char *filename, report_context * ctx, const char *charset)
|
||||
{
|
||||
if (get_param_int(global.parameters, "jsreport.enabled", 0) != 0) {
|
||||
if (config_get_int("jsreport.enabled", 0) != 0) {
|
||||
FILE * F = fopen(filename, "w");
|
||||
if (F) {
|
||||
int x, y, minx = INT_MAX, maxx = INT_MIN, miny = INT_MAX, maxy = INT_MIN;
|
||||
|
|
|
@ -419,7 +419,7 @@ int roqf_factor(void)
|
|||
{
|
||||
int value = -1;
|
||||
if (value < 0) {
|
||||
value = get_param_int(global.parameters, "rules.economy.roqf", 10);
|
||||
value = config_get_int("rules.economy.roqf", 10);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
if (b) {
|
||||
if (rule_other < 0) {
|
||||
rule_other =
|
||||
get_param_int(global.parameters, "rules.build.other_buildings", 1);
|
||||
config_get_int("rules.build.other_buildings", 1);
|
||||
}
|
||||
if (!rule_other) {
|
||||
unit *owner = building_owner(b);
|
||||
|
|
|
@ -531,7 +531,7 @@ int bt_effsize(const building_type * btype, const building * b, int bsize)
|
|||
const construction *cons = btype->construction;
|
||||
|
||||
/* TECH DEBT: simplest thing that works for E3 dwarf/halfling faction rules */
|
||||
if (b && get_param_int(global.parameters, "rules.dwarf_castles", 0)
|
||||
if (b && config_get_int("rules.dwarf_castles", 0)
|
||||
&& strcmp(btype->_name, "castle") == 0) {
|
||||
unit *u = building_owner(b);
|
||||
if (u && u->faction->race == get_race(RC_HALFLING)) {
|
||||
|
|
|
@ -110,7 +110,7 @@ int turn = -1;
|
|||
|
||||
int NewbieImmunity(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "NewbieImmunity", 0);
|
||||
return config_get_int("NewbieImmunity", 0);
|
||||
}
|
||||
|
||||
bool IsImmune(const faction * f)
|
||||
|
@ -137,7 +137,7 @@ static int ally_flag(const char *s, int help_mask)
|
|||
|
||||
bool ExpensiveMigrants(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "study.expensivemigrants", 0) != 0;
|
||||
return config_get_int("study.expensivemigrants", 0) != 0;
|
||||
}
|
||||
|
||||
/** Specifies automatic alliance modes.
|
||||
|
@ -147,7 +147,7 @@ bool ExpensiveMigrants(void)
|
|||
int AllianceAuto(void)
|
||||
{
|
||||
int value;
|
||||
const char *str = get_param(global.parameters, "alliance.auto");
|
||||
const char *str = config_get("alliance.auto");
|
||||
value = 0;
|
||||
if (str != NULL) {
|
||||
char *sstr = _strdup(str);
|
||||
|
@ -169,7 +169,7 @@ int AllianceAuto(void)
|
|||
*/
|
||||
int HelpMask(void)
|
||||
{
|
||||
const char *str = get_param(global.parameters, "rules.help.mask");
|
||||
const char *str = config_get("rules.help.mask");
|
||||
int rule = 0;
|
||||
if (str != NULL) {
|
||||
char *sstr = _strdup(str);
|
||||
|
@ -188,7 +188,7 @@ int HelpMask(void)
|
|||
|
||||
int AllianceRestricted(void)
|
||||
{
|
||||
const char *str = get_param(global.parameters, "alliance.restricted");
|
||||
const char *str = config_get("alliance.restricted");
|
||||
int rule = 0;
|
||||
if (str != NULL) {
|
||||
char *sstr = _strdup(str);
|
||||
|
@ -211,18 +211,18 @@ int LongHunger(const struct unit *u)
|
|||
if (u_race(u) == get_race(RC_DAEMON))
|
||||
return false;
|
||||
}
|
||||
return get_param_int(global.parameters, "hunger.long", 0);
|
||||
return config_get_int("hunger.long", 0);
|
||||
}
|
||||
|
||||
int SkillCap(skill_t sk)
|
||||
{
|
||||
if (sk == SK_MAGIC) return 0; /* no caps on magic */
|
||||
return get_param_int(global.parameters, "skill.maxlevel", 0);
|
||||
return config_get_int("skill.maxlevel", 0);
|
||||
}
|
||||
|
||||
int NMRTimeout(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "nmr.timeout", 0);
|
||||
return config_get_int("nmr.timeout", 0);
|
||||
}
|
||||
|
||||
race_t old_race(const struct race * rc)
|
||||
|
@ -371,8 +371,7 @@ static attrib_type at_maxmagicians = {
|
|||
|
||||
int max_magicians(const faction * f)
|
||||
{
|
||||
int m =
|
||||
get_param_int(global.parameters, "rules.maxskills.magic", MAXMAGICIANS);
|
||||
int m = config_get_int("rules.maxskills.magic", MAXMAGICIANS);
|
||||
attrib *a;
|
||||
|
||||
if ((a = a_find(f->attribs, &at_maxmagicians)) != NULL) {
|
||||
|
@ -567,7 +566,7 @@ int count_maxmigrants(const faction * f)
|
|||
static int migrants = -1;
|
||||
|
||||
if (migrants < 0) {
|
||||
migrants = get_param_int(global.parameters, "rules.migrants.max", INT_MAX);
|
||||
migrants = config_get_int("rules.migrants.max", INT_MAX);
|
||||
}
|
||||
if (migrants == INT_MAX) {
|
||||
int x = 0;
|
||||
|
@ -931,7 +930,7 @@ void init_locale(struct locale *lang)
|
|||
|
||||
tokens = get_translations(lang, UT_MAGIC);
|
||||
if (tokens) {
|
||||
const char *str = get_param(global.parameters, "rules.magic.playerschools");
|
||||
const char *str = config_get("rules.magic.playerschools");
|
||||
char *sstr, *tok;
|
||||
if (str == NULL) {
|
||||
str = "gwyrrd illaun draig cerddor tybied";
|
||||
|
@ -1281,25 +1280,25 @@ int cmp_current_owner(const building * b, const building * a)
|
|||
|
||||
bool rule_stealth_other(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "stealth.faction.other", 1);
|
||||
int rule = config_get_int("stealth.faction.other", 1);
|
||||
return rule != 0;
|
||||
}
|
||||
|
||||
bool rule_stealth_anon(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "stealth.faction.anon", 1);
|
||||
int rule = config_get_int("stealth.faction.anon", 1);
|
||||
return rule != 0;
|
||||
}
|
||||
|
||||
bool rule_region_owners(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.region_owners", 0);
|
||||
int rule = config_get_int("rules.region_owners", 0);
|
||||
return rule != 0;
|
||||
}
|
||||
|
||||
int rule_blessed_harvest(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.blessed_harvest.flags",
|
||||
int rule = config_get_int("rules.blessed_harvest.flags",
|
||||
HARVEST_WORK);
|
||||
assert(rule >= 0);
|
||||
return rule;
|
||||
|
@ -1307,14 +1306,14 @@ int rule_blessed_harvest(void)
|
|||
|
||||
int rule_alliance_limit(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.limit.alliance", 0);
|
||||
int rule = config_get_int("rules.limit.alliance", 0);
|
||||
assert(rule >= 0);
|
||||
return rule;
|
||||
}
|
||||
|
||||
int rule_faction_limit(void)
|
||||
{
|
||||
int rule = get_param_int(global.parameters, "rules.limit.faction", 0);
|
||||
int rule = config_get_int("rules.limit.faction", 0);
|
||||
assert(rule >= 0);
|
||||
return rule;
|
||||
}
|
||||
|
@ -1564,12 +1563,12 @@ int entertainmoney(const region * r)
|
|||
|
||||
int rule_give(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "rules.give.flags", GIVE_DEFAULT);
|
||||
return config_get_int("rules.give.flags", GIVE_DEFAULT);
|
||||
}
|
||||
|
||||
bool markets_module(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "modules.markets", 0);
|
||||
return config_get_int("modules.markets", 0);
|
||||
}
|
||||
|
||||
void config_set(const char *key, const char *value) {
|
||||
|
@ -1629,11 +1628,11 @@ void free_gamedata(void)
|
|||
}
|
||||
|
||||
const char * game_name(void) {
|
||||
const char * param = get_param(global.parameters, "game.name");
|
||||
const char * param = config_get("game.name");
|
||||
return param ? param : global.gamename;
|
||||
}
|
||||
|
||||
int game_id(void) {
|
||||
return get_param_int(global.parameters, "game.id", 0);
|
||||
return config_get_int("game.id", 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ static int allied_skilllimit(const faction * f, skill_t sk)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value < 0) {
|
||||
value = get_param_int(global.parameters, "alliance.skilllimit", 0);
|
||||
value = config_get_int("alliance.skilllimit", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -611,8 +611,7 @@ int skill_limit(faction * f, skill_t sk)
|
|||
m = max_magicians(f);
|
||||
}
|
||||
else if (sk == SK_ALCHEMY) {
|
||||
m = get_param_int(global.parameters, "rules.maxskills.alchemy",
|
||||
MAXALCHEMISTS);
|
||||
m = config_get_int("rules.maxskills.alchemy", MAXALCHEMISTS);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -74,11 +74,11 @@ static void test_settings(CuTest * tc)
|
|||
|
||||
test_cleanup();
|
||||
json_config(json);
|
||||
CuAssertStrEquals(tc, "1", get_param(global.parameters, "true"));
|
||||
CuAssertStrEquals(tc, "0", get_param(global.parameters, "false"));
|
||||
CuAssertStrEquals(tc, "1d4", get_param(global.parameters, "string"));
|
||||
CuAssertIntEquals(tc, 14, get_param_int(global.parameters, "integer", 0));
|
||||
CuAssertDblEquals(tc, 1.5f, get_param_flt(global.parameters, "float", 0), 0.01);
|
||||
CuAssertStrEquals(tc, "1", config_get("true"));
|
||||
CuAssertStrEquals(tc, "0", config_get("false"));
|
||||
CuAssertStrEquals(tc, "1d4", config_get("string"));
|
||||
CuAssertIntEquals(tc, 14, config_get_int("integer", 0));
|
||||
CuAssertDblEquals(tc, 1.5f, config_get_flt("float", 0), 0.01);
|
||||
cJSON_Delete(json);
|
||||
test_cleanup();
|
||||
}
|
||||
|
@ -117,13 +117,13 @@ static void test_disable(CuTest * tc)
|
|||
CuAssertTrue(tc, !keyword_disabled(K_BANNER));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_PAY));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_BESIEGE));
|
||||
CuAssertIntEquals(tc, 1, get_param_int(global.parameters, "module.enabled", 1));
|
||||
CuAssertIntEquals(tc, 1, config_get_int("module.enabled", 1));
|
||||
json_config(json);
|
||||
CuAssertTrue(tc, !skill_enabled(SK_ALCHEMY));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_BANNER));
|
||||
CuAssertTrue(tc, keyword_disabled(K_PAY));
|
||||
CuAssertTrue(tc, keyword_disabled(K_BESIEGE));
|
||||
CuAssertIntEquals(tc, 0, get_param_int(global.parameters, "module.enabled", 1));
|
||||
CuAssertIntEquals(tc, 0, config_get_int("module.enabled", 1));
|
||||
cJSON_Delete(json);
|
||||
test_cleanup();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ static double ResourceFactor(void)
|
|||
{
|
||||
static double value = -1.0;
|
||||
if (value < 0) {
|
||||
const char *str = get_param(global.parameters, "resource.factor");
|
||||
const char *str = config_get("resource.factor");
|
||||
value = str ? atof(str) : 1.0;
|
||||
}
|
||||
return value;
|
||||
|
@ -84,7 +84,7 @@ void terraform_resources(region * r)
|
|||
const terrain_type *terrain = r->terrain;
|
||||
static int terraform_all = -1;
|
||||
if (terraform_all < 0) {
|
||||
terraform_all = get_param_int(global.parameters, "rules.terraform.all", 0);
|
||||
terraform_all = config_get_int("rules.terraform.all", 0);
|
||||
}
|
||||
|
||||
if (terrain->production == NULL)
|
||||
|
|
|
@ -271,7 +271,7 @@ const char *write_shipname(const ship * sh, char *ibuf, size_t size)
|
|||
|
||||
static int ShipSpeedBonus(const unit * u)
|
||||
{
|
||||
int level = get_param_int(global.parameters, "movement.shipspeed.skillbonus", 0);
|
||||
int level = config_get_int("movement.shipspeed.skillbonus", 0);
|
||||
if (level > 0) {
|
||||
ship *sh = u->ship;
|
||||
int skl = effskill(u, SK_SAILING, 0);
|
||||
|
|
|
@ -212,7 +212,7 @@ void sk_set(skill * sv, int level)
|
|||
|
||||
static int rule_random_progress(void)
|
||||
{
|
||||
return get_param_int(global.parameters, "study.random_progress", 1);
|
||||
return config_get_int("study.random_progress", 1);
|
||||
}
|
||||
|
||||
int skill_weeks(int level)
|
||||
|
|
|
@ -182,8 +182,7 @@ bool is_astral(const region * r)
|
|||
plane *get_astralplane(void)
|
||||
{
|
||||
plane *astralspace = 0;
|
||||
int rule_astralplane =
|
||||
get_param_int(global.parameters, "modules.astralspace", 1);
|
||||
int rule_astralplane = config_get_int("modules.astralspace", 1);
|
||||
|
||||
if (!rule_astralplane) {
|
||||
return NULL;
|
||||
|
|
|
@ -232,7 +232,7 @@ static buddy *get_friends(const unit * u, int *numfriends)
|
|||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (u2->faction != f && u2->number > 0) {
|
||||
int allied = 0;
|
||||
if (get_param_int(global.parameters, "rules.alliances", 0) != 0) {
|
||||
if (config_get_int("rules.alliances", 0) != 0) {
|
||||
allied = (f->alliance && f->alliance == u2->faction->alliance);
|
||||
}
|
||||
else if (alliedunit(u, u2->faction, HELP_MONEY)
|
||||
|
@ -856,7 +856,7 @@ bool can_leave(unit * u)
|
|||
return true;
|
||||
}
|
||||
|
||||
rule_leave = get_param_int(global.parameters, "rules.move.owner_leave", 0);
|
||||
rule_leave = config_get_int("rules.move.owner_leave", 0);
|
||||
|
||||
if (rule_leave!=0 && u->building && u == building_owner(u->building)) {
|
||||
return false;
|
||||
|
@ -1343,7 +1343,7 @@ int get_modifier(const unit * u, skill_t sk, int level, const region * r, bool n
|
|||
skill = skillmod(u->attribs, u, r, sk, skill, SMF_ALWAYS);
|
||||
|
||||
if (hunger_red_skill == -1) {
|
||||
hunger_red_skill = get_param_int(global.parameters, "rules.hunger.reduces_skill", 2);
|
||||
hunger_red_skill = config_get_int("rules.hunger.reduces_skill", 2);
|
||||
}
|
||||
|
||||
if (fval(u, UFL_HUNGER) && hunger_red_skill) {
|
||||
|
@ -1727,8 +1727,7 @@ int unit_max_hp(const unit * u)
|
|||
static const curse_type *heal_ct = NULL;
|
||||
|
||||
if (rules_stamina < 0) {
|
||||
rules_stamina =
|
||||
get_param_int(global.parameters, "rules.stamina", STAMINA_AFFECTS_HP);
|
||||
rules_stamina = config_get_int("rules.stamina", STAMINA_AFFECTS_HP);
|
||||
}
|
||||
h = u_race(u)->hitpoints;
|
||||
|
||||
|
@ -1931,7 +1930,7 @@ bool unit_can_study(const unit *u) {
|
|||
}
|
||||
|
||||
static double produceexp_chance(void) {
|
||||
return get_param_flt(global.parameters, "study.from_use", 1.0 / 3);
|
||||
return config_get_flt("study.from_use", 1.0 / 3);
|
||||
}
|
||||
|
||||
void produceexp_ex(struct unit *u, skill_t sk, int n, bool (*learn)(unit *, skill_t, double))
|
||||
|
|
38
src/laws.c
38
src/laws.c
|
@ -117,7 +117,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
static bool RemoveNMRNewbie(void)
|
||||
{
|
||||
int value = get_param_int(global.parameters, "nmr.removenewbie", 0);
|
||||
int value = config_get_int("nmr.removenewbie", 0);
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ static void calculate_emigration(region * r)
|
|||
|
||||
static double peasant_growth_factor(void)
|
||||
{
|
||||
return get_param_flt(global.parameters, "rules.peasants.growth.factor", 0.0001F * PEASANTGROWTH);
|
||||
return config_get_flt("rules.peasants.growth.factor", 0.0001F * PEASANTGROWTH);
|
||||
}
|
||||
|
||||
#ifdef SLOWLUCK
|
||||
|
@ -275,7 +275,7 @@ int peasant_luck_effect(int peasants, int luck, int maxp, double variance) {
|
|||
#else
|
||||
static double peasant_luck_factor(void)
|
||||
{
|
||||
return get_param_flt(global.parameters, "rules.peasants.peasantluck.factor", PEASANTLUCK);
|
||||
return config_get_flt("rules.peasants.peasantluck.factor", PEASANTLUCK);
|
||||
}
|
||||
|
||||
int peasant_luck_effect(int peasants, int luck, int maxp, double variance)
|
||||
|
@ -305,7 +305,7 @@ static void peasants(region * r)
|
|||
int n, satiated;
|
||||
int dead = 0;
|
||||
|
||||
if (peasants > 0 && get_param_int(global.parameters, "rules.peasants.growth", 1)) {
|
||||
if (peasants > 0 && config_get_int("rules.peasants.growth", 1)) {
|
||||
int luck = 0;
|
||||
double fraction = peasants * peasant_growth_factor();
|
||||
int births = RAND_ROUND(fraction);
|
||||
|
@ -692,7 +692,7 @@ void immigration(void)
|
|||
{
|
||||
region *r;
|
||||
log_info(" - Einwanderung...");
|
||||
int repopulate = get_param_int(global.parameters, "rules.economy.repopulate_maximum", 90);
|
||||
int repopulate = config_get_int("rules.economy.repopulate_maximum", 90);
|
||||
for (r = regions; r; r = r->next) {
|
||||
if (r->land && r->land->newpeasants) {
|
||||
int rp = rpeasants(r) + r->land->newpeasants;
|
||||
|
@ -738,7 +738,7 @@ void nmr_warnings(void)
|
|||
message *msg = NULL;
|
||||
for (fa = factions; fa; fa = fa->next) {
|
||||
int warn = 0;
|
||||
if (get_param_int(global.parameters, "rules.alliances", 0) != 0) {
|
||||
if (config_get_int("rules.alliances", 0) != 0) {
|
||||
if (f->alliance && f->alliance == fa->alliance) {
|
||||
warn = 1;
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ void demographics(void)
|
|||
|
||||
if (plant_rules < 0) {
|
||||
plant_rules =
|
||||
get_param_int(global.parameters, "rules.grow.formula", 0);
|
||||
config_get_int("rules.grow.formula", 0);
|
||||
}
|
||||
for (dmd = r->land->demands; dmd; dmd = dmd->next) {
|
||||
if (dmd->value > 0 && dmd->value < MAXDEMAND) {
|
||||
|
@ -990,7 +990,7 @@ static bool CheckOverload(void)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value < 0) {
|
||||
value = get_param_int(global.parameters, "rules.check_overload", 0);
|
||||
value = config_get_int("rules.check_overload", 0);
|
||||
}
|
||||
return value != 0;
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ static void nmr_death(faction * f)
|
|||
{
|
||||
static int rule = -1;
|
||||
if (rule < 0)
|
||||
rule = get_param_int(global.parameters, "rules.nmr.destroy", 0);
|
||||
rule = config_get_int("rules.nmr.destroy", 0);
|
||||
if (rule) {
|
||||
unit *u;
|
||||
for (u = f->units; u; u = u->nextF) {
|
||||
|
@ -2742,14 +2742,12 @@ void sinkships(struct region * r)
|
|||
if (fval(r->terrain, SEA_REGION)) {
|
||||
if (!enoughsailors(sh, crew_skill(sh))) {
|
||||
// ship is at sea, but not enough people to control it
|
||||
double dmg = get_param_flt(global.parameters,
|
||||
"rules.ship.damage.nocrewocean",
|
||||
0.30F);
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrewocean", 0.3);
|
||||
damage_ship(sh, dmg);
|
||||
}
|
||||
} else if (!ship_owner(sh)) {
|
||||
// any ship lying around without an owner slowly rots
|
||||
double dmg = get_param_flt(global.parameters, "rules.ship.damage.nocrew", 0.05F);
|
||||
double dmg = config_get_flt("rules.ship.damage.nocrew", 0.05);
|
||||
damage_ship(sh, dmg);
|
||||
}
|
||||
}
|
||||
|
@ -4260,7 +4258,7 @@ static void do_force_leave(region *r) {
|
|||
}
|
||||
|
||||
bool rule_force_leave(int flags) {
|
||||
int rules = get_param_int(global.parameters, "rules.owners.force_leave", 0);
|
||||
int rules = config_get_int("rules.owners.force_leave", 0);
|
||||
return (rules&flags) == flags;
|
||||
}
|
||||
|
||||
|
@ -4331,7 +4329,7 @@ void init_processor(void)
|
|||
add_proc_order(p, K_GUARD, guard_off_cmd, 0, NULL);
|
||||
add_proc_order(p, K_RESHOW, reshow_cmd, 0, NULL);
|
||||
|
||||
if (get_param_int(global.parameters, "rules.alliances", 0) == 1) {
|
||||
if (config_get_int("rules.alliances", 0) == 1) {
|
||||
p += 10;
|
||||
add_proc_global(p, alliance_cmd, NULL);
|
||||
}
|
||||
|
@ -4363,7 +4361,7 @@ void init_processor(void)
|
|||
|
||||
p += 10; /* can't allow reserve before siege (weapons) */
|
||||
add_proc_region(p, enter_1, "Betreten (3. Versuch)"); /* to claim a castle after a victory and to be able to DESTROY it in the same turn */
|
||||
if (get_param_int(global.parameters, "rules.reserve.twophase", 0)) {
|
||||
if (config_get_int("rules.reserve.twophase", 0)) {
|
||||
add_proc_order(p, K_RESERVE, reserve_self, 0, "RESERVE (self)");
|
||||
p += 10;
|
||||
}
|
||||
|
@ -4415,7 +4413,7 @@ void init_processor(void)
|
|||
p += 10;
|
||||
add_proc_global(p, movement, "Bewegungen");
|
||||
|
||||
if (get_param_int(global.parameters, "work.auto", 0)) {
|
||||
if (config_get_int("work.auto", 0)) {
|
||||
p += 10;
|
||||
add_proc_region(p, auto_work, "Arbeiten (auto)");
|
||||
}
|
||||
|
@ -4423,7 +4421,7 @@ void init_processor(void)
|
|||
p += 10;
|
||||
add_proc_order(p, K_GUARD, guard_on_cmd, 0, "Bewache (an)");
|
||||
|
||||
if (get_param_int(global.parameters, "rules.encounters", 0)) {
|
||||
if (config_get_int("rules.encounters", 0)) {
|
||||
p += 10;
|
||||
add_proc_global(p, encounters, "Zufallsbegegnungen");
|
||||
}
|
||||
|
@ -4461,7 +4459,7 @@ void processorders(void)
|
|||
process();
|
||||
/*************************************************/
|
||||
|
||||
if (get_param_int(global.parameters, "modules.markets", 0)) {
|
||||
if (config_get_int("modules.markets", 0)) {
|
||||
do_markets();
|
||||
}
|
||||
|
||||
|
@ -4470,7 +4468,7 @@ void processorders(void)
|
|||
remove_empty_units();
|
||||
|
||||
/* must happen AFTER age, because that would destroy them right away */
|
||||
if (get_param_int(global.parameters, "modules.wormholes", 0)) {
|
||||
if (config_get_int("modules.wormholes", 0)) {
|
||||
wormholes_update();
|
||||
}
|
||||
|
||||
|
|
13
src/magic.c
13
src/magic.c
|
@ -112,7 +112,7 @@ static float MagicRegeneration(void)
|
|||
{
|
||||
static float value = -1.0;
|
||||
if (value < 0) {
|
||||
const char *str = get_param(global.parameters, "magic.regeneration");
|
||||
const char *str = config_get("magic.regeneration");
|
||||
value = str ? (float)atof(str) : 1.0F;
|
||||
}
|
||||
return value;
|
||||
|
@ -121,7 +121,7 @@ static float MagicRegeneration(void)
|
|||
static double MagicPower(double force)
|
||||
{
|
||||
if (force > 0) {
|
||||
const char *str = get_param(global.parameters, "magic.power");
|
||||
const char *str = config_get("magic.power");
|
||||
double value = str ? atof(str) : 1.0;
|
||||
return _max(value * force, 1.0f);
|
||||
}
|
||||
|
@ -217,8 +217,7 @@ bool FactionSpells(void)
|
|||
{
|
||||
static int rules_factionspells = -1;
|
||||
if (rules_factionspells < 0) {
|
||||
rules_factionspells =
|
||||
get_param_int(global.parameters, "rules.magic.factionlist", 0);
|
||||
rules_factionspells = config_get_int("rules.magic.factionlist", 0);
|
||||
}
|
||||
return rules_factionspells!=0;
|
||||
}
|
||||
|
@ -1034,7 +1033,7 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order
|
|||
if (btype && btype->flags & BTF_MAGIC) ++force;
|
||||
}
|
||||
|
||||
elf_power = get_param_int(global.parameters, "rules.magic.elfpower", 0);
|
||||
elf_power = config_get_int("rules.magic.elfpower", 0);
|
||||
|
||||
if (elf_power && u_race(u) == get_race(RC_ELF) && r_isforest(r)) {
|
||||
++force;
|
||||
|
@ -1291,7 +1290,7 @@ bool fumble(region * r, unit * u, const spell * sp, int cast_grade)
|
|||
int effsk = effskill(u, SK_MAGIC, r);
|
||||
struct building *b = inside_building(u);
|
||||
const struct building_type *btype = building_is_active(b) ? b->type : NULL;
|
||||
int fumble_enabled = get_param_int(global.parameters, "magic.fumble.enable", 1);
|
||||
int fumble_enabled = config_get_int("magic.fumble.enable", 1);
|
||||
sc_mage * mage;
|
||||
|
||||
if (effsk<=0 || !fumble_enabled) {
|
||||
|
@ -1463,7 +1462,7 @@ void regenerate_aura(void)
|
|||
double reg_aura;
|
||||
int regen;
|
||||
double mod;
|
||||
int regen_enabled = get_param_int(global.parameters, "magic.regeneration.enable", 1);
|
||||
int regen_enabled = config_get_int("magic.regeneration.enable", 1);
|
||||
|
||||
if (!regen_enabled) return;
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ faction *get_or_create_monsters(void)
|
|||
faction *f = findfaction(MONSTER_ID);
|
||||
if (!f) {
|
||||
const race *rc = rc_get_or_create("dragon");
|
||||
const char *email = get_param(global.parameters, "monster.email");
|
||||
const char *email = config_get("monster.email");
|
||||
f = addfaction(email ? email : "noreply@eressea.de", NULL, rc, default_locale, 0);
|
||||
renumber_faction(f, MONSTER_ID);
|
||||
faction_setname(f, "Monster");
|
||||
|
|
|
@ -82,7 +82,7 @@ static void give_peasants(unit *u, const item_type *itype, int reduce) {
|
|||
}
|
||||
|
||||
static double monster_attack_chance(void) {
|
||||
return get_param_flt(global.parameters, "rules.monsters.attack_chance", 0.4f);
|
||||
return config_get_flt("rules.monsters.attack_chance", 0.4);
|
||||
}
|
||||
|
||||
static void reduce_weight(unit * u)
|
||||
|
|
26
src/move.c
26
src/move.c
|
@ -319,7 +319,7 @@ int walkingcapacity(const struct unit *u)
|
|||
if (rbelt) {
|
||||
int belts = i_get(u->items, rbelt->itype);
|
||||
if (belts) {
|
||||
int multi = get_param_int(global.parameters, "rules.trollbelt.multiplier", STRENGTHMULTIPLIER);
|
||||
int multi = config_get_int("rules.trollbelt.multiplier", STRENGTHMULTIPLIER);
|
||||
n += _min(people, belts) * (multi - 1) * u_race(u)->capacity;
|
||||
}
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ static float damage_drift(void)
|
|||
{
|
||||
static float value = -1.0F;
|
||||
if (value < 0) {
|
||||
value = (float)get_param_flt(global.parameters, "rules.ship.damage_drift", 0.02F);
|
||||
value = (float)config_get_flt("rules.ship.damage_drift", 0.02F);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ static float damage_drift(void)
|
|||
static void drifting_ships(region * r)
|
||||
{
|
||||
direction_t d;
|
||||
bool drift = get_param_int(global.parameters, "rules.ship.drifting", 1) != 0;
|
||||
bool drift = config_get_int("rules.ship.drifting", 1) != 0;
|
||||
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
ship **shp = &r->ships;
|
||||
|
@ -839,12 +839,12 @@ static unit *bewegung_blockiert_von(unit * reisender, region * r)
|
|||
int stealth = eff_stealth(reisender, r);
|
||||
const struct resource_type *ramulet = get_resourcetype(R_AMULET_OF_TRUE_SEEING);
|
||||
|
||||
double base_prob = get_param_flt(global.parameters, "rules.guard.base_stop_prob", .3f);
|
||||
double skill_prob = get_param_flt(global.parameters, "rules.guard.skill_stop_prob", .1f);
|
||||
double amulet_prob = get_param_flt(global.parameters, "rules.guard.amulet_stop_prob", .1f);
|
||||
double guard_number_prob = get_param_flt(global.parameters, "rules.guard.guard_number_stop_prob", .001f);
|
||||
double castle_prob = get_param_flt(global.parameters, "rules.guard.castle_stop_prob", .1f);
|
||||
double region_type_prob = get_param_flt(global.parameters, "rules.guard.region_type_stop_prob", .1f);
|
||||
double base_prob = config_get_flt("rules.guard.base_stop_prob", .3);
|
||||
double skill_prob = config_get_flt("rules.guard.skill_stop_prob", .1);
|
||||
double amulet_prob = config_get_flt("rules.guard.amulet_stop_prob", .1);
|
||||
double guard_number_prob = config_get_flt("rules.guard.guard_number_stop_prob", .001);
|
||||
double castle_prob = config_get_flt("rules.guard.castle_stop_prob", .1);
|
||||
double region_type_prob = config_get_flt("rules.guard.region_type_stop_prob", .1);
|
||||
|
||||
if (fval(u_race(reisender), RCF_ILLUSIONARY))
|
||||
return NULL;
|
||||
|
@ -1785,7 +1785,7 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
|
|||
if (!flying_ship(sh)) {
|
||||
int stormchance = 0;
|
||||
int reason;
|
||||
bool storms_enabled = get_param_int(global.parameters, "rules.ship.storms", 1) != 0;
|
||||
bool storms_enabled = config_get_int("rules.ship.storms", 1) != 0;
|
||||
if (storms_enabled) {
|
||||
int stormyness;
|
||||
gamedate date;
|
||||
|
@ -1795,7 +1795,7 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
|
|||
/* storms should be the first thing we do. */
|
||||
stormchance = stormyness / shipspeed(sh, u);
|
||||
if (check_leuchtturm(next_point, NULL)) {
|
||||
int param = get_param_int(global.parameters, "rules.lighthous.stormchancedevisor", 0);
|
||||
int param = config_get_int("rules.lighthous.stormchancedevisor", 0);
|
||||
if (param > 0) {
|
||||
stormchance /= param;
|
||||
}
|
||||
|
@ -1885,9 +1885,7 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
|
|||
ADDMSG(&f->msgs, msg_message("sailnolandingstorm", "ship region", sh, next_point));
|
||||
}
|
||||
else {
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.nolanding",
|
||||
0.10F);
|
||||
double dmg = config_get_flt("rules.ship.damage.nolanding", 0.1);
|
||||
ADDMSG(&f->msgs, msg_message("sailnolanding", "ship region", sh,
|
||||
next_point));
|
||||
damage_ship(sh, dmg);
|
||||
|
|
|
@ -738,9 +738,7 @@ static void move_iceberg(region * r)
|
|||
|
||||
for (sh = r->ships; sh; sh = sh->next) {
|
||||
/* Meldung an Kapitän */
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.intoiceberg",
|
||||
0.10F);
|
||||
double dmg = config_get_flt("rules.ship.damage.intoiceberg", 0.1);
|
||||
damage_ship(sh, dmg);
|
||||
fset(sh, SF_SELECT);
|
||||
}
|
||||
|
@ -751,9 +749,7 @@ static void move_iceberg(region * r)
|
|||
translist(&rc->buildings, &r->buildings, rc->buildings);
|
||||
}
|
||||
while (rc->ships) {
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.withiceberg",
|
||||
0.10F);
|
||||
double dmg = config_get_flt("rules.ship.damage.withiceberg", 0.1);
|
||||
fset(rc->ships, SF_SELECT);
|
||||
damage_ship(rc->ships, dmg);
|
||||
move_ship(rc->ships, rc, r, NULL);
|
||||
|
@ -885,9 +881,7 @@ static void godcurse(void)
|
|||
ship *sh;
|
||||
for (sh = r->ships; sh;) {
|
||||
ship *shn = sh->next;
|
||||
double dmg =
|
||||
get_param_flt(global.parameters, "rules.ship.damage.godcurse",
|
||||
0.10F);
|
||||
double dmg = config_get_flt("rules.ship.damage.godcurse", 0.1);
|
||||
damage_ship(sh, dmg);
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
unit *u = ship_owner(sh);
|
||||
|
@ -970,8 +964,7 @@ static void demon_skillchanges(void)
|
|||
/* hungry demons only go down, never up in skill */
|
||||
static int rule_hunger = -1;
|
||||
if (rule_hunger < 0) {
|
||||
rule_hunger =
|
||||
get_param_int(global.parameters, "hunger.demon.skill", 0);
|
||||
rule_hunger = config_get_int("hunger.demon.skill", 0);
|
||||
}
|
||||
if (rule_hunger) {
|
||||
upchance = 0;
|
||||
|
@ -1023,8 +1016,7 @@ static void rotting_herbs(void)
|
|||
region *r;
|
||||
|
||||
if (rule_rot < 0) {
|
||||
rule_rot =
|
||||
get_param_int(global.parameters, "rules.economy.herbrot", HERBROTCHANCE);
|
||||
rule_rot = config_get_int("rules.economy.herbrot", HERBROTCHANCE);
|
||||
}
|
||||
if (rule_rot == 0) return;
|
||||
|
||||
|
|
|
@ -1678,7 +1678,7 @@ int reports(void)
|
|||
free_seen();
|
||||
#ifdef GLOBAL_REPORT
|
||||
{
|
||||
const char *str = get_param(global.parameters, "globalreport");
|
||||
const char *str = config_get("globalreport");
|
||||
if (str != NULL) {
|
||||
sprintf(path, "%s/%s.%u.cr", reportpath(), str, turn);
|
||||
global_report(path);
|
||||
|
|
|
@ -121,7 +121,7 @@ int study_cost(unit * u, skill_t sk)
|
|||
if (cost[sk] == 0) {
|
||||
char buffer[256];
|
||||
sprintf(buffer, "skills.cost.%s", skillnames[sk]);
|
||||
cost[sk] = get_param_int(global.parameters, buffer, -1);
|
||||
cost[sk] = config_get_int(buffer, -1);
|
||||
}
|
||||
if (cost[sk] >= 0) {
|
||||
return cost[sk];
|
||||
|
@ -545,13 +545,13 @@ int study_cmd(unit * u, order * ord)
|
|||
int money = 0;
|
||||
skill_t sk;
|
||||
int maxalchemy = 0;
|
||||
int speed_rule = (study_rule_t)get_param_int(global.parameters, "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);
|
||||
const struct building_type *btype = building_is_active(b) ? b->type : NULL;
|
||||
|
||||
if (learn_newskills < 0) {
|
||||
const char *str = get_param(global.parameters, "study.newskills");
|
||||
const char *str = config_get("study.newskills");
|
||||
if (str && strcmp(str, "false") == 0)
|
||||
learn_newskills = 0;
|
||||
else
|
||||
|
|
|
@ -67,7 +67,7 @@ static bool hunger(int number, unit * u)
|
|||
static const race *rc = 0;
|
||||
|
||||
if (!damage) {
|
||||
damage = get_param(global.parameters, "hunger.damage");
|
||||
damage = config_get("hunger.damage");
|
||||
if (damage == NULL)
|
||||
damage = "1d12+12";
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void get_food(region * r)
|
|||
plane *pl = rplane(r);
|
||||
unit *u;
|
||||
int peasantfood = rpeasants(r) * 10;
|
||||
int food_rules = get_param_int(global.parameters, "rules.food.flags", 0);
|
||||
int food_rules = config_get_int("rules.food.flags", 0);
|
||||
|
||||
if (food_rules & FOOD_IS_FREE) {
|
||||
return;
|
||||
|
@ -272,7 +272,7 @@ void get_food(region * r)
|
|||
if (hungry > 0) {
|
||||
static int demon_hunger = -1;
|
||||
if (demon_hunger < 0) {
|
||||
demon_hunger = get_param_int(global.parameters, "hunger.demons", 0);
|
||||
demon_hunger = config_get_int("hunger.demons", 0);
|
||||
}
|
||||
if (demon_hunger == 0) {
|
||||
/* demons who don't feed are hungry */
|
||||
|
|
Loading…
Add table
Reference in a new issue