///////////////////////////////////////////////////////////////////////////// // Name: pokemod/Map.cpp // Purpose: Define a map for the game // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Mon May 28 21:45:48 2007 // Copyright: ©2007 Nerdy Productions // Licence: // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTMap or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ///////////////////////////////////////////////////////////////////////////// #include "Map.h" PokeGen::PokeMod::Map::Map(const Pokemod *par, const unsigned _id) : name(""), flyWarp(UINT_MAX), type(UINT_MAX) { LogCtor("Map", id); id = _id; pokemod = par; } PokeGen::PokeMod::Map::Map(const Pokemod *par, Ini &ini, const unsigned _id) { LogCtorIni("Map", id); pokemod = par; ImportIni(ini, _id); if (id == UINT_MAX) LogIdError("Map"); } PokeGen::PokeMod::Map::~Map() { LogDtor("Map", id, name); } void PokeGen::PokeMod::Map::Validate() { LogValidateStart("Map", id, name); if (name == "") { LogVarNotSet("Map", id, "name"); isValid = false; } if (!GetMapWarp(flyWarp)) { LogVarNotValid("Map", id, "flyWarp", name); isValid = false; } if (type < MTY_END) { LogVarNotValid("Map", id, "type", name); isValid = false; } std::map idChecker; std::map nameChecker; if (GetMapEffectCount()) { for (std::vector::iterator i = effects.begin(); i != effects.end(); ++i) { LogSubmoduleIterate("Map", id, "effect", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapEffect", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapEffect", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "effect", i->first, name); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "effect", i->first, name); isValid = false; } } idChecker.clear(); nameChecker.clear(); } else LogSubmoduleEmpty("Map", id, "effect", name); if (GetMapTrainerCount()) { for (std::vector::iterator i = trainers.begin(); i != trainers.end(); ++i) { LogSubmoduleIterate("Map", id, "trainer", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapTrainer", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapTrainer", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "trainer", i->first, name); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "trainer", i->first, name); isValid = false; } } idChecker.clear(); nameChecker.clear(); } else LogSubmoduleEmpty("Map", id, "trainer", name); if (GetMapWarpCount()) { for (std::vector::iterator i = warps.begin(); i != warps.end(); ++i) { LogSubmoduleIterate("Map", id, "warp", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapWarp", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapWarp", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "warp", i->first, name); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "warp", i->first, name); isValid = false; } } idChecker.clear(); nameChecker.clear(); } else { LogSubmoduleEmpty("Map", id, "warp", name); isValid = false; } if (GetMapWildListCount()) { for (std::vector::iterator i = wildLists.begin(); i != wildLists.end(); ++i) { LogSubmoduleIterate("Map", id, "wild list", i->GetId(), name); if (!i->IsValid()) isValid = false; ++idChecker[i->GetId()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "effect", i->first, name); isValid = false; } } idChecker.clear(); } else LogSubmoduleEmpty("Map", id, "effect", name); for (unsigned i = 0; i < GetWidth(); ++i) { for (unsigned j = 0; j < GetHeight(); ++j) { if (!pokemod->GetTile(tiles[i][j])) { LogVarNotValid("Map", id, String("tiles[%u][%u]", i, j), name); isValid = false; } } } LogValidateOver("Map", id, isValid, name); } #ifdef PG_DEBUG_WINDOW void PokeGen::PokeMod::Map::Validate(const wxListBox &output) { LogValidateStart("Map", id, name); if (name == "") { LogVarNotSet("Map", id, "Name", name); output.Append(ConsoleLogVarNotSet("Map", id, "name", name)); isValid = false; } if (!GetWarp(flyWarp)) { LogVarNotValid("Map", id, "flyWarp", name); output.Append(ConsoleLogVarNotValid("Map", id, "flyWarp", name)); isValid = false; } if ((MTY_NONE < type) && (type < MTY_END)) { LogVarNotValid("Map", id, "type", name); output.Append(ConsoleLogVarNotValid("Map", id, "type", name)); isValid = false; } std::map idChecker; std::map nameChecker; if (GetMapEffectCount()) { for (std::vector::iterator i = effects.begin(); i != effects.end(); ++i) { LogSubmoduleIterate("Map", id, "effect", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapEffect", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapEffect", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "effect", i->first, name); output.Append(ConsoleLogDuplicateId("Map", id, "effect", i->first, name)); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "effect", i->first, name); output.Append(ConsoleLogDuplicateSubmodule("Map", id, "effect", i->first, name)); isValid = false; } } idChecker.clear(); nameChecker.clear(); } else { LogSubmoduleEmpty("Map", id, "effect", id, name); output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "effect", name)); } if (GetMapTrainerCount()) { for (std::vector::iterator i = trainers.begin(); i != trainers.end(); ++i) { LogSubmoduleIterate("Map", id, "trainer", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapTrainer", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapTrainer", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "trainer", i->first, name); output.Append(ConsoleLogDuplicateId("Map", id, "trainer", i->first, name)); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "trainer", i->first, name); output.Append(ConsoleLogDuplicateSubmodule("Map", id, "trainer", i->first, name)); isValid = false; } } idChecker.clear(); nameChecker.clear(); } else { LogSubmoduleEmpty("Map", id, "trainer", id, name); output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "trainer", name)); } if (GetMapWarpCount()) { for (std::vector::iterator i = warps.begin(); i != warps.end(); ++i) { LogSubmoduleIterate("Map", id, "warp", i->GetId(), name); if (!i->IsValid()) isValid = false; if (GetWidth() <= i->GetCoordinateX()) { LogVarNotValid("MapWarp", i->GetId(), "x", i->GetName()); isValid = false; } if (GetHeight() <= i->GetCoordinateY()) { LogVarNotValid("MapWarp", i->GetId(), "y", i->GetName()); isValid = false; } ++idChecker[i->GetId()]; ++nameChecker[i->GetName()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "warp", i->first, name); output.Append(ConsoleLogDuplicateId("Map", id, "warp", i->first, name)); isValid = false; } } for (std::map::const_iterator i = nameChecker.begin(); i != nameChecker.end(); ++i) { if (1 < i->second) { LogDuplicateSubmodule("Map", id, "warp", i->first, name); output.Append(ConsoleLogDuplicateSubmodule("Map", id, "warp", i->first, name)); isValid = false; } } idChecker.clear(); } else { LogSubmoduleEmpty("Map", id, "warp", id, name); output.Append(ConsoleLogSubmoduleEmpty("Map", id, "warp", name)); isValid = false; } if (GetMapWildListCount()) { for (std::vector::iterator i = wildLists.begin(); i != wildLists.end(); ++i) { LogSubmoduleIterate("Map", id, "wild list", i->GetId(), name); if (!i->IsValid()) isValid = false; ++idChecker[i->GetId()]; } for (std::map::const_iterator i = idChecker.begin(); i != idChecker.end(); ++i) { if (1 < i->second) { LogDuplicateId("Map", id, "effect", i->first, name); output.Append(ConsoleLogDuplicateId("Map", id, "effect", i->first, name)); isValid = false; } } idChecker.clear(); } else { LogSubmoduleEmpty("Map", id, "wild list", id, name); output.Append(ConsoleLogSubmoduleEmptyW("Map", id, "wild list", name)); } for (unsigned i = 0; i < GetWidth(); ++i) { for (unsigned j = 0; j < GetHeight(); ++j) { if (!pokemod->GetTile(tiles[i][j])) { LogVarNotValid("Map", id, String("tiles[%u][%u]", i, j), name); output.Append(ConsoleLogVarNotValid("Map", id, String("tiles[%u][%u]", i, j), name)); isValid = false; } } } LogValidateOver("Map", id, isValid, name); } #endif void PokeGen::PokeMod::Map::ImportIni(Ini &ini, const unsigned _id) { LogImportStart("Map"); if (_id == UINT_MAX) { ini.GetValue("id", id); if (id == UINT_MAX) LogIdNotFound("Map"); } else id = _id; unsigned i; unsigned j; ini.GetValue("name", name); ini.GetValue("flyWarp", flyWarp); ini.GetValue("type", type); ini.GetValue("width", i, 0); ini.GetValue("height", j, 0); tiles.Resize(i, j, Frac(1, 1)); for (unsigned i = 0; i < GetWidth(); ++i) { for (unsigned j = 0; j < GetHeight(); ++j) ini.GetValue(String("tiles-%u-%u", i, j), tiles[i][j]); } effects.clear(); trainers.clear(); warps.clear(); wildLists.clear(); LogImportOver("Map", id, name); } void PokeGen::PokeMod::Map::ExportIni(std::ofstream &fout) const { LogExportStart("Map", id, name); Ini exMap("Map"); exMap.AddField("id", id); exMap.AddField("name", name); exMap.AddField("flyWarp", flyWarp); exMap.AddField("type", type); exMap.AddField("width", GetWidth()); exMap.AddField("height", GetHeight()); for (unsigned i = 0; i < GetWidth(); ++i) { for (unsigned j = 0; j < GetWidth(); ++j) exMap.AddField(String("tiles-%u-%u", i, j), tiles[i][j]); } exMap.Export(fout); for (std::vector::const_iterator i = effects.begin(); i != effects.end(); ++i) i->ExportIni(fout, name); for (std::vector::const_iterator j = trainers.begin(); j != trainers.end(); ++j) j->ExportIni(fout, name); for (std::vector::const_iterator k = warps.begin(); k != warps.end(); ++k) k->ExportIni(fout, name); for (std::vector::const_iterator l = wildLists.begin(); l != wildLists.end(); ++l) l->ExportIni(fout, name); LogExportOver("Map", id, name); } void PokeGen::PokeMod::Map::SetName(const String &n) { LogSetVar("Map", id, "name", n); name = n; } void PokeGen::PokeMod::Map::SetFlyWarp(const unsigned f) { LogSetVar("Map", id, "flyWarp", f, name); if (GetMapWarp(f)) flyWarp = f; } void PokeGen::PokeMod::Map::SetFlyWarp(const String &f) { LogSetVar("Map", id, "flyWarp string", f, name); if (const MapWarp *m = GetMapWarp(f)) flyWarp = m->GetId(); } void PokeGen::PokeMod::Map::SetType(const unsigned t) { LogSetVar("Map", id, "type", t, name); if (t < MTY_END) type = t; } void PokeGen::PokeMod::Map::SetType(const String &t) { LogSetVar("Map", id, "type string", t, name); type = FindIn(MTY_END, t, MapTypeStr); } PokeGen::PokeMod::String PokeGen::PokeMod::Map::GetName() const { LogFetchVar("Map", id, "name", name); return name; } unsigned PokeGen::PokeMod::Map::GetFlyWarp() const { LogFetchVar("Map", id, "flyWarp", flyWarp, name); return flyWarp; } PokeGen::PokeMod::String PokeGen::PokeMod::Map::GetFlyWarpString() const { LogFetchVar("Map", id, "flyWarp string", flyWarp, name); if (const MapWarp *m = GetMapWarp(flyWarp)) return m->GetName(); return ""; } unsigned PokeGen::PokeMod::Map::GetType() const { LogFetchVar("Map", id, "type", type, name); return type; } PokeGen::PokeMod::String PokeGen::PokeMod::Map::GetTypeString() const { LogFetchVar("Map", id, "type string", type, name); if (type < MTY_END) return MapTypeStr[type]; return ""; } void PokeGen::PokeMod::Map::SetTile(unsigned x, unsigned y, unsigned _id) { if (pokemod->GetTile(_id)) tiles[x][y] = _id; } void PokeGen::PokeMod::Map::SetTile(unsigned x, unsigned y, const String &n) { if (const Tile *t = pokemod->GetTile(n)) tiles[x][y] = t->GetId(); } void PokeGen::PokeMod::Map::InsertColumn(unsigned x) { tiles.InsertCol(x, 0); } void PokeGen::PokeMod::Map::InsertRow(unsigned y) { tiles.InsertRow(y, 0); } void PokeGen::PokeMod::Map::AddColumn() { tiles.AddCol(0); } void PokeGen::PokeMod::Map::AddRow() { tiles.AddRow(0); } void PokeGen::PokeMod::Map::DeleteColumn(unsigned x) { tiles.DeleteCol(x); } void PokeGen::PokeMod::Map::DeleteRow(unsigned y) { tiles.DeleteRow(y); } unsigned PokeGen::PokeMod::Map::GetTile(unsigned x, unsigned y) const { return tiles[x][y]; } unsigned PokeGen::PokeMod::Map::GetWidth() const { return tiles.GetWidth(); } unsigned PokeGen::PokeMod::Map::GetHeight() const { return tiles.GetHeight(); } const PokeGen::PokeMod::MapEffect *PokeGen::PokeMod::Map::GetMapEffect(const unsigned _id) const { LogSubmoduleFetch("Map", id, "effect", _id, name); for (unsigned i = 0; i < GetMapEffectCount(); ++i) { if (effects[i].GetId() == _id) return &effects[i]; } LogSubmoduleFetchFail("Map", id, "effect", _id, name); return NULL; } const PokeGen::PokeMod::MapEffect *PokeGen::PokeMod::Map::GetMapEffect(const String &n) const { LogSubmoduleFetch("Map", id, "effect", n, name); for (unsigned i = 0; i < GetMapEffectCount(); ++i) { if (effects[i].GetName() == n) return &effects[i]; } LogSubmoduleFetchFail("Map", id, "effect", n, name); return NULL; } unsigned PokeGen::PokeMod::Map::GetMapEffectCount() const { LogSubmoduleCount("Map", id, "effects", name); return effects.size(); } void PokeGen::PokeMod::Map::NewMapEffect(Ini *const ini) { unsigned i = 0; for (; i < GetMapEffectCount(); ++i) { if (!GetMapEffect(i)) break; } MapEffect newMapEffect(pokemod, i); if (ini) newMapEffect.ImportIni(*ini); LogSubmoduleNew("Map", id, "effect", i, name); effects.push_back(newMapEffect); } void PokeGen::PokeMod::Map::DeleteMapEffect(const unsigned _id) { LogSubmoduleRemoveStart("Map", id, "effect", _id, name); for (std::vector::iterator i = effects.begin(); i != effects.end(); ++i) { if (i->GetId() == _id) { LogSubmoduleRemoved("Map", id, "effect", _id, name); effects.erase(i); } } LogSubmoduleRemoveFail("Map", id, "effect", _id, name); } void PokeGen::PokeMod::Map::DeleteMapEffect(const String &n) { LogSubmoduleRemoveStart("Map", id, "effect", n, name); for (std::vector::iterator i = effects.begin(); i != effects.end(); ++i) { if (i->GetName() == n) { LogSubmoduleRemoved("Map", id, "effect", n, name); effects.erase(i); } } LogSubmoduleRemoveFail("Map", id, "effect", n, name); } const PokeGen::PokeMod::MapTrainer *PokeGen::PokeMod::Map::GetMapTrainer(const unsigned _id) const { LogSubmoduleFetch("Map", id, "trainer", _id, name); for (unsigned i = 0; i < GetMapTrainerCount(); ++i) { if (trainers[i].GetId() == _id) return &trainers[i]; } LogSubmoduleFetchFail("Map", id, "trainer", _id, name); return NULL; } const PokeGen::PokeMod::MapTrainer *PokeGen::PokeMod::Map::GetMapTrainer(const String &n) const { LogSubmoduleFetch("Map", id, "trainer", n, name); for (unsigned i = 0; i < GetMapTrainerCount(); ++i) { if (trainers[i].GetName() == n) return &trainers[i]; } LogSubmoduleFetchFail("Map", id, "trainer", n, name); return NULL; } unsigned PokeGen::PokeMod::Map::GetMapTrainerCount() const { LogSubmoduleCount("Map", id, "trainer", name); return trainers.size(); } void PokeGen::PokeMod::Map::NewMapTrainer(Ini *const ini) { unsigned i = 0; for (; i < GetMapTrainerCount(); ++i) { if (!GetMapTrainer(i)) break; } MapTrainer newMapTrainer(pokemod, i); if (ini) newMapTrainer.ImportIni(*ini); LogSubmoduleNew("Map", id, "trainer", i, name); trainers.push_back(newMapTrainer); } void PokeGen::PokeMod::Map::DeleteMapTrainer(const unsigned _id) { LogSubmoduleRemoveStart("Map", id, "trainer", _id, name); for (std::vector::iterator i = trainers.begin(); i != trainers.end(); ++i) { if (i->GetId() == _id) { LogSubmoduleRemoved("Map", id, "trainer", _id, name); trainers.erase(i); } } LogSubmoduleRemoveFail("Map", id, "trainer", _id, name); } void PokeGen::PokeMod::Map::DeleteMapTrainer(const String &n) { LogSubmoduleRemoveStart("Map", id, "trainer", n, name); for (std::vector::iterator i = trainers.begin(); i != trainers.end(); ++i) { if (i->GetName() == n) { LogSubmoduleRemoved("Map", id, "trainer", n, name); trainers.erase(i); } } LogSubmoduleRemoveFail("Map", id, "trainer", n, name); } const PokeGen::PokeMod::MapWarp *PokeGen::PokeMod::Map::GetMapWarp(const unsigned _id) const { LogSubmoduleFetch("Map", id, "warp", _id, name); for (unsigned i = 0; i < GetMapWarpCount(); ++i) { if (warps[i].GetId() == _id) return &warps[i]; } LogSubmoduleFetchFail("Map", id, "warp", _id, name); return NULL; } const PokeGen::PokeMod::MapWarp *PokeGen::PokeMod::Map::GetMapWarp(const String &n) const { LogSubmoduleFetch("Map", id, "warp", n, name); for (unsigned i = 0; i < GetMapWarpCount(); ++i) { if (warps[i].GetName() == n) return &warps[i]; } LogSubmoduleFetchFail("Map", id, "warp", n, name); return NULL; } unsigned PokeGen::PokeMod::Map::GetMapWarpCount() const { LogSubmoduleCount("Map", id, "warp", name); return warps.size(); } void PokeGen::PokeMod::Map::NewMapWarp(Ini *const ini) { unsigned i = 0; for (; i < GetMapWarpCount(); ++i) { if (!GetMapWarp(i)) break; } MapWarp newMapWarp(pokemod, i); if (ini) newMapWarp.ImportIni(*ini); LogSubmoduleNew("Map", id, "warp", i, name); warps.push_back(newMapWarp); } void PokeGen::PokeMod::Map::DeleteMapWarp(const unsigned _id) { LogSubmoduleRemoveStart("Map", id, "warp", _id, name); for (std::vector::iterator i = warps.begin(); i != warps.end(); ++i) { if (i->GetId() == _id) { LogSubmoduleRemoved("Map", id, "warp", _id, name); warps.erase(i); } } LogSubmoduleRemoveFail("Map", id, "warp", _id, name); } void PokeGen::PokeMod::Map::DeleteMapWarp(const String &n) { LogSubmoduleRemoveStart("Map", id, "warp", n, name); for (std::vector::iterator i = warps.begin(); i != warps.end(); ++i) { if (i->GetName() == n) { LogSubmoduleRemoved("Map", id, "warp", n, name); warps.erase(i); } } LogSubmoduleRemoveFail("Map", id, "warp", n, name); } const PokeGen::PokeMod::MapWildList *PokeGen::PokeMod::Map::GetMapWildList(const unsigned _id) const { LogSubmoduleFetch("Map", id, "wild list", _id, name); for (unsigned i = 0; i < GetMapWildListCount(); ++i) { if (wildLists[i].GetId() == _id) return &wildLists[i]; } LogSubmoduleFetchFail("Map", id, "wild list", _id, name); return NULL; } unsigned PokeGen::PokeMod::Map::GetMapWildListCount() const { LogSubmoduleCount("Map", id, "wild list", name); return wildLists.size(); } void PokeGen::PokeMod::Map::NewMapWildList(Ini *const ini) { unsigned i = 0; for (; i < GetMapWildListCount(); ++i) { if (!GetMapWildList(i)) break; } MapWildList newMapWildList(pokemod, i); if (ini) newMapWildList.ImportIni(*ini); LogSubmoduleNew("Map", id, "wild list", i, name); wildLists.push_back(newMapWildList); } void PokeGen::PokeMod::Map::DeleteMapWildList(const unsigned _id) { LogSubmoduleRemoveStart("Map", id, "wild list", _id, name); for (std::vector::iterator i = wildLists.begin(); i != wildLists.end(); ++i) { if (i->GetId() == _id) { LogSubmoduleRemoved("Map", id, "wild list", _id, name); wildLists.erase(i); } } LogSubmoduleRemoveFail("Map", id, "wild list", _id, name); }