From 0a5c8c0293f0b106390f6a9cc8327d1fcef9fbb2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 7 Jan 2005 23:19:10 +0000 Subject: [PATCH] =?UTF-8?q?NewbieImmunity=20=C3=BCber=20config-datei=20kon?= =?UTF-8?q?trolliert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/economy.c | 4 ++-- src/common/gamecode/laws.c | 6 +++--- src/common/kernel/battle.c | 4 ++-- src/common/kernel/eressea.c | 10 ++++++++++ src/common/kernel/eressea.h | 1 + src/res/hse-05-01.xml | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index eaf3b3cf8..ba364172a 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2580,10 +2580,10 @@ steal_cmd(unit * u, struct order * ord, request ** stealorders) return; } - if (u2->faction->age < IMMUN_GEGEN_ANGRIFF) { + if (u2->faction->age < NewbieImmunity()) { add_message(&u->faction->msgs, msg_feedback(u, ord, "newbie_immunity_error", - "turns", IMMUN_GEGEN_ANGRIFF)); + "turns", NewbieImmunity())); return; } diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 9768fedec..30bc8b10f 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -2711,7 +2711,7 @@ remove_unequipped_guarded(void) for (r = regions; r; r = r->next) for (u = r->units; u; u = u->next) { - if (getguard(u) && (!armedmen(u) || u->faction->age < IMMUN_GEGEN_ANGRIFF)) + if (getguard(u) && (!armedmen(u) || u->faction->age < NewbieImmunity())) setguard(u, GUARD_NONE); } } @@ -3609,9 +3609,9 @@ age_factions(void) for (f = factions; f; f = f->next) { ++f->age; - if (f->age < IMMUN_GEGEN_ANGRIFF) { + if (f->age < NewbieImmunity()) { add_message(&f->msgs, new_message(f, - "newbieimmunity%i:turns", IMMUN_GEGEN_ANGRIFF - f->age)); + "newbieimmunity%i:turns", NewbieImmunity() - f->age)); } } } diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 512246388..469fbf1d6 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -3577,9 +3577,9 @@ init_battle(region * r, battle **bp) sprintf(buf, "%s ist böse gewesen...", unitname(u)); mistake(u, ord, buf, MSG_BATTLE); continue; - } if (u2->faction->age < IMMUN_GEGEN_ANGRIFF) { + } if (u2->faction->age < NewbieImmunity()) { add_message(&u->faction->msgs, - msg_feedback(u, u->thisorder, "newbie_immunity_error", "turns", IMMUN_GEGEN_ANGRIFF)); + msg_feedback(u, u->thisorder, "newbie_immunity_error", "turns", NewbieImmunity())); continue; } /* Fehler: "Die Einheit ist mit uns alliert" */ diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index abdbc6f72..4782a6fe6 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -107,6 +107,16 @@ static attrib_type at_creator = { /* Rest ist NULL; temporäres, nicht alterndes Attribut */ }; +static int +NewbieImmunity(void) { + static int value = -1; + if (value<0) { + const char * str = get_param(global.parameters, "NewbieImmunity"); + value = str?atoi(str):IMMUN_GEGEN_ANGRIFF; + } + return value; +} + static int MaxAge(void) { static int value = -1; diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 45f036227..306186888 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1181,6 +1181,7 @@ extern int NMRTimeout(void); extern int LongHunger(const struct unit * u); extern boolean TradeDisabled(void); extern int SkillCap(skill_t sk); +extern int NewbieImmunity(); extern int AllianceAuto(void); /* flags that allied factions get automatically */ extern int AllianceRestricted(void); /* flags restricted to allied factions */ extern struct order * default_order(const struct locale * lang); diff --git a/src/res/hse-05-01.xml b/src/res/hse-05-01.xml index 793fdaf3b..3e1be774c 100644 --- a/src/res/hse-05-01.xml +++ b/src/res/hse-05-01.xml @@ -30,6 +30,7 @@ +