| 1006 | } |
| 1007 | |
| 1008 | sp<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 | |
| 1032 | void BattleMapPart::clearSupportedParts() { supportedParts.clear(); } |
| 1033 | |