From f93fb831dd8238a3a39e1302401da1d1d01455ea 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 | 14 +++++++------- redalert/scenario.h | 9 ++++----- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/redalert/aircraft.cpp b/redalert/aircraft.cpp index 7fc3450c..deb2ec7d 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 c0b9d86f..03b41f9b 100644 --- a/redalert/scenario.cpp +++ b/redalert/scenario.cpp @@ -164,9 +164,8 @@ 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 AutoSonarTimer(AUTOSONAR_PERIOD) @@ -784,8 +783,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..67d8279d 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 + */ + unsigned EnableEvac : 1; /* ** This is the fading countdown timer. As this timer counts down, the