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

Method getSupportedParts

game/state/battle/battlemappart.cpp:1008–1030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006}
1007
1008sp<std::set<SupportedMapPart *>> BattleMapPart::getSupportedParts()
1009{
1010 sp<std::set<SupportedMapPart *>> supportedMapParts = mksp<std::set<SupportedMapPart *>>();
1011 auto &map = tileObject->map;
1012 // Since we reference supported parts by type we have to find each in it's tile by type
1013 for (auto &p : supportedParts)
1014 {
1015 auto tile = map.getTile(p.first);
1016 for (auto &obj : tile->ownedObjects)
1017 {
1018 if (obj->getType() == TileObjectBattleMapPart::convertType(p.second))
1019 {
1020 auto mp = std::static_pointer_cast<TileObjectBattleMapPart>(obj)->getOwner();
1021 if (mp->destroyed)
1022 {
1023 continue;
1024 }
1025 supportedMapParts->insert(mp.get());
1026 }
1027 }
1028 }
1029 return supportedMapParts;
1030}
1031
1032void BattleMapPart::clearSupportedParts() { supportedParts.clear(); }
1033

Callers

nothing calls this directly

Calls 5

getTileMethod · 0.80
insertMethod · 0.80
getTypeMethod · 0.45
getOwnerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected