/** * liefert einen Map-Layer zurück. * * @param[in] type Typ des Layers. */ std::vector<unsigned char>& glArchivItem_Map::GetLayer(MapLayer type) { RTTR_Assert(HasLayer(type)); libsiedler2::ArchivItem_Raw* item = dynamic_cast<libsiedler2::ArchivItem_Raw*>(get(type + 1)); // 0 = header RTTR_Assert(item); return item->getData(); }
vector<Entity*> Entity::FindAllByLayerInChildren(const Layer& layer) { vector<Entity*> results; if (IsEnabled() && HasLayer(layer.name)) { results.push_back(this); } for(auto it = begin(children); it != end(children); ++it) { vector<Entity*> layerChildren = FindAllByLayerInChildren(layer); results.insert(end(results), begin(layerChildren), end(layerChildren)); } return results; }
Entity* Entity::FindAnyByLayerInChildren(const Layer& layer) { if (IsEnabled()) { if (HasLayer(layer.name)) { return this; } else { for(auto it = begin(children); it != end(children); ++it) { Entity* layerChild = FindAnyByLayerInChildren(layer); if (layerChild) { return layerChild; } } } } return nullptr; }