diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 015e1bb74..aff7ab058 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -2927,7 +2927,7 @@ steal_cmd(unit * u, struct order * ord, request ** stealorders) return; } - if (u2->faction->age < NewbieImmunity()) { + if (IsImmune(u2->faction)) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "newbie_immunity_error", "turns", NewbieImmunity())); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 9f124d8cd..46d56f7a1 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -2603,7 +2603,7 @@ can_start_guarding(const unit * u) if (u->status>=ST_FLEE) return E_GUARD_FLEEING; if (fval(u->race, RCF_UNARMEDGUARD)) return E_GUARD_OK; if (!armedmen(u, true)) return E_GUARD_UNARMED; - if (u->faction->age < NewbieImmunity()) return E_GUARD_NEWBIE; + if (IsImmune(u->faction)) return E_GUARD_NEWBIE; return E_GUARD_OK; } diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index b39d1ac6b..13090451b 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -4028,7 +4028,7 @@ init_battle(region * r, battle **bp) cmistake(u, ord, 47, MSG_BATTLE); continue; } - if (u2->faction->age < NewbieImmunity()) { + if (IsImmune(u2->faction)) { add_message(&u->faction->msgs, msg_feedback(u, u->thisorder, "newbie_immunity_error", "turns", NewbieImmunity())); continue; diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 5c532781f..104df08ef 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -117,6 +117,7 @@ attrib_type at_xontormiaexpress = { ATF_UNIQUE }; #endif + int NewbieImmunity(void) { static int value = -1; @@ -126,6 +127,12 @@ NewbieImmunity(void) { return value; } +boolean +IsImmune(const faction * f) +{ + return !fval(f, FFL_NPC) && f->age < NewbieImmunity(); +} + static int MaxAge(void) { static int value = -1; diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index d8bd245af..953677632 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -405,6 +405,7 @@ extern int NMRTimeout(void); extern int LongHunger(const struct unit * u); extern int SkillCap(skill_t sk); extern int NewbieImmunity(void); +extern boolean IsImmune(const struct faction * f); extern int AllianceAuto(void); /* flags that allied factions get automatically */ extern int AllianceRestricted(void); /* flags restricted to allied factions */ extern int HelpMask(void); /* flags restricted to allied factions */ diff --git a/src/eressea.sln b/src/eressea.sln index 626508234..e9af6e9a6 100644 --- a/src/eressea.sln +++ b/src/eressea.sln @@ -1,7 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "common\util.vcproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "common\kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "common\gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}" @@ -21,10 +19,6 @@ Global Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Profile|Win32.ActiveCfg = Profile|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Profile|Win32.Build.0 = Profile|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.ActiveCfg = Release|Win32 {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.ActiveCfg = Debug|Win32 {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Profile|Win32.ActiveCfg = Profile|Win32 {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Profile|Win32.Build.0 = Profile|Win32