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

Method deriveRank

src/Savegame/BattleUnit.cpp:2512–2529  ·  view source on GitHub ↗

* Derive the numeric unit rank from the string rank * (for soldier units). */

Source from the content-addressed store, hash-verified

2510 * (for soldier units).
2511 */
2512void BattleUnit::deriveRank()
2513{
2514 if (_faction == FACTION_PLAYER)
2515 {
2516 if (_rank == "STR_COMMANDER")
2517 _rankInt = 5;
2518 else if (_rank == "STR_COLONEL")
2519 _rankInt = 4;
2520 else if (_rank == "STR_CAPTAIN")
2521 _rankInt = 3;
2522 else if (_rank == "STR_SERGEANT")
2523 _rankInt = 2;
2524 else if (_rank == "STR_SQUADDIE")
2525 _rankInt = 1;
2526 else if (_rank == "STR_ROOKIE")
2527 _rankInt = 0;
2528 }
2529}
2530
2531/**
2532 * this function checks if a tile is visible, using maths.

Callers 1

addXCOMUnitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected