Skip to content

Commit

Permalink
Prevent evacuate logic by default in MP, add EvacInMP map keyword to …
Browse files Browse the repository at this point in the history
…enable evac and add DisableEvac keyword to disable evacuate entirely for sp&mp
  • Loading branch information
Maikel authored and OmniBlade committed Jun 28, 2022
1 parent 3777ae9 commit afe532c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions redalert/aircraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
*=============================================================================================*/
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) {
return false;
}

/*
** If the candidate pointer is missing, then return with failure code.
*/
Expand Down
6 changes: 5 additions & 1 deletion redalert/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ ScenarioClass::ScenarioClass(void)
, IsNoMapSel(false)
, IsTruckCrate(false)
, IsMoneyTiberium(false)
,
, EvacInMP(false)
, DisableEvac(false)
,
#ifdef FIXIT_VERSION_3 // For endgame auto-sonar pulse.
#define AUTOSONAR_PERIOD TICKS_PER_SECOND * 40
AutoSonarTimer(AUTOSONAR_PERIOD)
Expand Down Expand Up @@ -2302,6 +2304,8 @@ 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_Int(BASIC, "EvacInMP", Scen.EvacInMP);
Scen.DisableEvac = ini.Get_Int(BASIC, "DisableEvac", Scen.DisableEvac);

/*
** Read in the specific information for each of the house types. This creates
Expand Down
8 changes: 7 additions & 1 deletion redalert/scenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class ScenarioClass
unsigned IsToInherit : 1;

/*
** If Tanya or a civilian is to be automatically evacuated when they enter
** If Tanya is to be automatically evacuated when they enter
** a transport vehicle, then this flag will be true.
*/
unsigned IsTanyaEvac : 1;
Expand Down Expand Up @@ -310,6 +310,12 @@ 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;

/*
** This is the fading countdown timer. As this timer counts down, the
** fading to b&w or color will progress. This timer represents a
Expand Down

0 comments on commit afe532c

Please sign in to comment.