Skip to content

Commit e9f2098

Browse files
committed
Fix handling a mix of unconscious and MIA units
Let's assume we have only 2 units on the craft. - 2 MIA units = craft lost - 2 unconscious units = craft lost - 1 MIA unit + 1 unconscious unit = craft NOT lost (and unconscious unit survives) This is now fixed and in all 3 cases the craft is lost.
1 parent db24774 commit e9f2098

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

‎src/Battlescape/DebriefingState.cpp‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ void DebriefingState::prepareDebriefing()
806806
int playersSurvived = 0; // if this stays 0 the craft is lost...
807807
int playersUnconscious = 0;
808808
int playersInEntryArea = 0;
809+
int playersMIA = 0;
809810

810811
_stats.push_back(new DebriefingStat("STR_ALIENS_KILLED", false));
811812
_stats.push_back(new DebriefingStat("STR_ALIEN_CORPSES_RECOVERED", false));
@@ -1000,20 +1001,36 @@ void DebriefingState::prepareDebriefing()
10001001
{
10011002
playersInEntryArea++;
10021003
}
1004+
else if (aborted)
1005+
{
1006+
// if aborted, conscious xcom unit that is not on start/end point counts as MIA
1007+
playersMIA++;
1008+
}
10031009
playersSurvived++;
10041010
}
10051011
else if ((*j)->getOriginalFaction() == FACTION_PLAYER && (*j)->getStatus() == STATUS_DEAD)
10061012
deadSoldiers++;
10071013
}
10081014
// if all our men are unconscious, the aliens get to have their way with them.
1009-
if (playersUnconscious == playersSurvived)
1015+
if (playersUnconscious + playersMIA == playersSurvived)
10101016
{
1011-
playersSurvived = 0;
1017+
playersSurvived = playersMIA;
10121018
for (std::vector<BattleUnit*>::iterator j = battle->getUnits()->begin(); j != battle->getUnits()->end(); ++j)
10131019
{
10141020
if ((*j)->getOriginalFaction() == FACTION_PLAYER && (*j)->getStatus() != STATUS_DEAD)
10151021
{
1016-
(*j)->instaKill();
1022+
if ((*j)->getStatus() == STATUS_UNCONSCIOUS || (*j)->getFaction() == FACTION_HOSTILE)
1023+
{
1024+
(*j)->instaKill();
1025+
}
1026+
else if ((*j)->getStatus() == STATUS_IGNORE_ME && (*j)->getStunlevel() >= (*j)->getHealth())
1027+
{
1028+
(*j)->instaKill();
1029+
}
1030+
else
1031+
{
1032+
// do nothing, units will be marked MIA later
1033+
}
10171034
}
10181035
}
10191036
}

0 commit comments

Comments
 (0)