MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / getHighestRankedXCom

Method getHighestRankedXCom

src/Savegame/SavedBattleGame.cpp:1546–1560  ·  view source on GitHub ↗

* Gets the highest ranked, living XCom unit. * @return The highest ranked, living XCom unit. */

Source from the content-addressed store, hash-verified

1544 * @return The highest ranked, living XCom unit.
1545 */
1546BattleUnit* SavedBattleGame::getHighestRankedXCom()
1547{
1548 BattleUnit* highest = 0;
1549 for (std::vector<BattleUnit*>::iterator j = _units.begin(); j != _units.end(); ++j)
1550 {
1551 if ((*j)->getOriginalFaction() == FACTION_PLAYER && !(*j)->isOut())
1552 {
1553 if (highest == 0 || (*j)->getRankInt() > highest->getRankInt())
1554 {
1555 highest = *j;
1556 }
1557 }
1558 }
1559 return highest;
1560}
1561
1562/**
1563 * Gets the morale modifier for

Callers

nothing calls this directly

Calls 3

getOriginalFactionMethod · 0.80
isOutMethod · 0.80
getRankIntMethod · 0.80

Tested by

no test coverage detected