From 370ad31319ee8d97ad308be8156e8953c9394e2d Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Thu, 27 Jan 2022 23:19:00 +0000 Subject: [PATCH] [RA] Gates evac logic behind EnableEvac ini key. Allows globally enabling or disabling evac logic on per map basis. Default behaviour is enabled in SP disabled in MP if key is absent. --- redalert/aircraft.cpp | 11 ++++------- redalert/scenario.cpp | 12 ++++++------ redalert/scenario.h | 9 ++++----- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/redalert/aircraft.cpp b/redalert/aircraft.cpp index b9c5232e..42ac5384 100644 --- a/redalert/aircraft.cpp +++ b/redalert/aircraft.cpp @@ -111,13 +111,10 @@ *=============================================================================================*/ static bool _Counts_As_Civ_Evac(ObjectClass const* candidate) { - if (Scen.DisableEvac) { - return false; - } - - // If it's a multiplayer game and the scenario doesn't have - // evacuate in multiplayer keyword defined, don't evacuate - if (Scen.EvacInMP == false && Session.Type != GAME_NORMAL) { + /* + ** If evac logic isn't enabled, no candidate can be evacuated. + */ + if (!Scen.EnableEvac) { return false; } diff --git a/redalert/scenario.cpp b/redalert/scenario.cpp index 1cc23983..ce6455e6 100644 --- a/redalert/scenario.cpp +++ b/redalert/scenario.cpp @@ -165,8 +165,7 @@ ScenarioClass::ScenarioClass(void) , IsNoMapSel(false) , IsTruckCrate(false) , IsMoneyTiberium(false) - , EvacInMP(false) - , DisableEvac(false) + , EnableEvac(true) , #ifdef FIXIT_VERSION_3 // For endgame auto-sonar pulse. #define AUTOSONAR_PERIOD TICKS_PER_SECOND * 40 @@ -785,8 +784,10 @@ void Clear_Scenario(void) Scen.CarryOverPercent = 0; Scen.TransitTheme = THEME_NONE; Scen.Percent = 0; - Scen.EvacInMP = false; - Scen.DisableEvac = false; + /* + ** Default setting for evac depends on session type. + */ + Scen.EnableEvac = Session.Type == GAME_NORMAL ? true : false; memset(Scen.GlobalFlags, 0, sizeof(Scen.GlobalFlags)); @@ -2306,8 +2307,7 @@ bool Read_Scenario_INI(char* fname, bool) Scen.IsTruckCrate = ini.Get_Bool(BASIC, "TruckCrate", Scen.IsTruckCrate); Scen.IsMoneyTiberium = ini.Get_Bool(BASIC, "FillSilos", Scen.IsMoneyTiberium); Scen.Percent = ini.Get_Int(BASIC, "Percent", Scen.Percent); - Scen.EvacInMP = ini.Get_Bool(BASIC, "EvacInMP", Scen.EvacInMP); - Scen.DisableEvac = ini.Get_Bool(BASIC, "DisableEvac", Scen.DisableEvac); + Scen.EnableEvac = ini.Get_Bool(BASIC, "EnableEvac", Scen.EnableEvac); /* ** Read in the specific information for each of the house types. This creates diff --git a/redalert/scenario.h b/redalert/scenario.h index feb4e6bc..19df8ee9 100644 --- a/redalert/scenario.h +++ b/redalert/scenario.h @@ -310,11 +310,10 @@ class ScenarioClass */ unsigned IsMoneyTiberium : 1; - /* With this disabled the units will not be evacuated in single player*/ - bool DisableEvac; - - /* by default evacuate is disabled for multiplayer*/ - bool EvacInMP; + /* + ** When set to false, units will not be evacuated no matter what + */ + bool EnableEvac; /* ** This is the fading countdown timer. As this timer counts down, the