Skip to content

Commit

Permalink
[RA] Gates evac logic behind EnableEvac ini key.
Browse files Browse the repository at this point in the history
Allows globally enabling or disabling evac logic on per map basis.
Default behaviour is enabled in SP disabled in MP if key is absent.
  • Loading branch information
OmniBlade committed Jan 27, 2022
1 parent 24d6d0f commit 370ad31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
11 changes: 4 additions & 7 deletions redalert/aircraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 6 additions & 6 deletions redalert/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions redalert/scenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 370ad31

Please sign in to comment.