Skip to content

Commit 5303e53

Browse files
committed
fix corpse recovery
1 parent 0c20c6c commit 5303e53

1 file changed

Lines changed: 41 additions & 38 deletions

File tree

src/Battlescape/DebriefingState.cpp

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,54 +1062,57 @@ void DebriefingState::recoverItems(std::vector<BattleItem*> *from, Base *base)
10621062
}
10631063
else
10641064
{
1065-
if ((*it)->getRules()->getRecoveryPoints() && !(*it)->getXCOMProperty())
1065+
if ((*it)->getRules()->isRecoverable())
10661066
{
1067-
if ((*it)->getRules()->getBattleType() == BT_CORPSE && (*it)->getUnit()->getStatus() == STATUS_DEAD)
1067+
if (!(*it)->getXCOMProperty())
10681068
{
1069-
addStat("STR_ALIEN_CORPSES_RECOVERED", 1, (*it)->getUnit()->getValue());
1070-
base->getItems()->addItem((*it)->getUnit()->getArmor()->getCorpseGeoscape(), 1);
1071-
}
1072-
else if ((*it)->getRules()->getBattleType() == BT_CORPSE && (*it)->getUnit()->getStatus() == STATUS_UNCONSCIOUS)
1073-
{
1074-
if ((*it)->getUnit()->getOriginalFaction() == FACTION_HOSTILE)
1069+
if ((*it)->getRules()->getBattleType() == BT_CORPSE && (*it)->getUnit()->getStatus() == STATUS_DEAD)
10751070
{
1076-
recoverAlien((*it)->getUnit(), base);
1071+
addStat("STR_ALIEN_CORPSES_RECOVERED", 1, (*it)->getUnit()->getValue());
1072+
base->getItems()->addItem((*it)->getUnit()->getArmor()->getCorpseGeoscape(), 1);
1073+
}
1074+
else if ((*it)->getRules()->getBattleType() == BT_CORPSE && (*it)->getUnit()->getStatus() == STATUS_UNCONSCIOUS)
1075+
{
1076+
if ((*it)->getUnit()->getOriginalFaction() == FACTION_HOSTILE)
1077+
{
1078+
recoverAlien((*it)->getUnit(), base);
1079+
}
1080+
else if ((*it)->getUnit()->getOriginalFaction() == FACTION_NEUTRAL)
1081+
{
1082+
addStat("STR_CIVILIANS_SAVED", 1, (*it)->getUnit()->getValue());
1083+
}
10771084
}
1078-
else if ((*it)->getUnit()->getOriginalFaction() == FACTION_NEUTRAL)
1085+
// only "recover" unresearched items
1086+
else if (!_game->getSavedGame()->isResearched((*it)->getRules()->getType()))
10791087
{
1080-
addStat("STR_CIVILIANS_SAVED", 1, (*it)->getUnit()->getValue());
1088+
addStat("STR_ALIEN_ARTIFACTS_RECOVERED", 1, (*it)->getRules()->getRecoveryPoints());
10811089
}
10821090
}
1083-
// only "recover" unresearched items
1084-
else if (!_game->getSavedGame()->isResearched((*it)->getRules()->getType()))
1085-
{
1086-
addStat("STR_ALIEN_ARTIFACTS_RECOVERED", 1, (*it)->getRules()->getRecoveryPoints());
1087-
}
1088-
}
1089-
// put items back in the base
1090-
if ((*it)->getRules()->isRecoverable() && !(*it)->getRules()->isFixed())
1091-
{
1092-
switch ((*it)->getRules()->getBattleType())
1091+
// put items back in the base
1092+
if (!(*it)->getRules()->isFixed())
10931093
{
1094-
case BT_CORPSE:
1095-
break;
1096-
case BT_AMMO:
1097-
// It's a clip, count any rounds left.
1098-
_rounds[(*it)->getRules()] += (*it)->getAmmoQuantity();
1099-
break;
1100-
case BT_FIREARM:
1101-
case BT_MELEE:
1102-
// It's a weapon, count any rounds left in the clip.
1103-
{
1104-
BattleItem *clip = (*it)->getAmmoItem();
1105-
if (clip && clip->getRules()->getClipSize() > 0 && clip != *it)
1094+
switch ((*it)->getRules()->getBattleType())
1095+
{
1096+
case BT_CORPSE:
1097+
break;
1098+
case BT_AMMO:
1099+
// It's a clip, count any rounds left.
1100+
_rounds[(*it)->getRules()] += (*it)->getAmmoQuantity();
1101+
break;
1102+
case BT_FIREARM:
1103+
case BT_MELEE:
1104+
// It's a weapon, count any rounds left in the clip.
11061105
{
1107-
_rounds[clip->getRules()] += clip->getAmmoQuantity();
1106+
BattleItem *clip = (*it)->getAmmoItem();
1107+
if (clip && clip->getRules()->getClipSize() > 0 && clip != *it)
1108+
{
1109+
_rounds[clip->getRules()] += clip->getAmmoQuantity();
1110+
}
11081111
}
1109-
}
1110-
// Fall-through, to recover the weapon itself.
1111-
default:
1112-
base->getItems()->addItem((*it)->getRules()->getType(), 1);
1112+
// Fall-through, to recover the weapon itself.
1113+
default:
1114+
base->getItems()->addItem((*it)->getRules()->getType(), 1);
1115+
}
11131116
}
11141117
}
11151118
}

0 commit comments

Comments
 (0)