const CustomSystem* CustomSystem::GetCustomSystem(const char *name) { for (SectorMap::iterator map_i = sector_map.begin(); map_i != sector_map.end(); ++map_i) { for (SystemList::iterator i = (*map_i).second.begin(); i != (*map_i).second.end(); ++i) { CustomSystem *cs = &(*i); if (cs->name != name) return cs; } } return NULL; }
void CustomSystem::Uninit() { for (SectorMap::iterator secIt = s_sectorMap.begin(); secIt != s_sectorMap.end(); ++secIt) { for (CustomSystem::SystemList::iterator sysIt = secIt->second.begin(); sysIt != secIt->second.end(); ++sysIt) { delete *sysIt; } } s_sectorMap.clear(); }
const std::list<const CustomSystem*> CustomSystem::GetCustomSystemsForSector(int x, int y, int z) { SystemPath path(x,y,z); SectorMap::iterator map_i = sector_map.find(path); std::list<const CustomSystem*> sector_systems; if (map_i != sector_map.end()) { for (SystemList::iterator i = (*map_i).second.begin(); i != (*map_i).second.end(); ++i) { CustomSystem *cs = &(*i); sector_systems.push_back(cs); } } return sector_systems; }
const CustomSystem::SystemList &CustomSystem::GetCustomSystemsForSector(int x, int y, int z) { SystemPath path(x,y,z); SectorMap::const_iterator it = s_sectorMap.find(path); return (it != s_sectorMap.end()) ? it->second : s_emptySystemList; }