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

Method sortRifles

src/Battlescape/UnitSprite.cpp:1188–1212  ·  view source on GitHub ↗

* Determines which weapons to display in the case of two-handed weapons. */

Source from the content-addressed store, hash-verified

1186 * Determines which weapons to display in the case of two-handed weapons.
1187 */
1188void UnitSprite::sortRifles()
1189{
1190 if (_itemA && _itemA->getRules()->isTwoHanded())
1191 {
1192 if (_itemB && _itemB->getRules()->isTwoHanded())
1193 {
1194 if (_unit->getActiveHand() == "STR_LEFT_HAND")
1195 {
1196 _itemA = _itemB;
1197 }
1198 _itemB = 0;
1199 }
1200 else if (_unit->getStatus() != STATUS_AIMING)
1201 {
1202 _itemB = 0;
1203 }
1204 }
1205 else if (_itemB && _itemB->getRules()->isTwoHanded())
1206 {
1207 if (_unit->getStatus() != STATUS_AIMING)
1208 {
1209 _itemA = 0;
1210 }
1211 }
1212}
1213
1214}

Callers

nothing calls this directly

Calls 4

isTwoHandedMethod · 0.80
getActiveHandMethod · 0.80
getRulesMethod · 0.45
getStatusMethod · 0.45

Tested by

no test coverage detected