MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getFirstItemInSlot

Method getFirstItemInSlot

game/state/shared/agent.cpp:1293–1313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291}
1292
1293sp<AEquipment> Agent::getFirstItemInSlot(EquipmentSlotType equipmentSlotType, bool lazy) const
1294{
1295 if (lazy)
1296 {
1297 if (equipmentSlotType == EquipmentSlotType::RightHand)
1298 return rightHandItem;
1299 if (equipmentSlotType == EquipmentSlotType::LeftHand)
1300 return leftHandItem;
1301 }
1302 for (auto &e : equipment)
1303 {
1304 for (auto &s : type->equipment_layout->slots)
1305 {
1306 if (s.bounds.p0 == e->equippedPosition && s.type == equipmentSlotType)
1307 {
1308 return e;
1309 }
1310 }
1311 }
1312 return nullptr;
1313}
1314
1315sp<AEquipment> Agent::getFirstItemByType(StateRef<AEquipmentType> equipmentType) const
1316{

Callers 15

initStateMethod · 0.80
getAccuracyMethod · 0.80
startAttackingMethod · 0.80
canAttackUnitMethod · 0.80
refreshReserveCostMethod · 0.80
updateCloakMethod · 0.80
updateMoraleMethod · 0.80
updateAttackingMethod · 0.80
updatePsiMethod · 0.80
thinkMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected