swap map to array

This commit is contained in:
Henrique 2011-11-08 00:12:23 -02:00
parent a3c65f3a7e
commit 6a17173d08
2 changed files with 4 additions and 7 deletions

View File

@ -232,12 +232,9 @@ void Map::removeThing(const ThingPtr& thing)
return;
if(MissilePtr shot = thing->asMissile()) {
m_missilesAtFloor[shot->getPosition().z];
for(auto it = m_missilesAtFloor[shot->getPosition().z].begin(), end = m_missilesAtFloor[shot->getPosition().z].end(); it != end; ++it) {
if(shot == *it) {
auto it = std::find(m_missilesAtFloor[shot->getPosition().z].begin(), m_missilesAtFloor[shot->getPosition().z].end(), shot);
if(it != m_missilesAtFloor[shot->getPosition().z].end()) {
m_missilesAtFloor[shot->getPosition().z].erase(it);
break;
}
}
return;
}

View File

@ -69,7 +69,7 @@ public:
private:
std::unordered_map<Position, TilePtr, PositionHasher> m_tiles;
std::map<uint32, CreaturePtr> m_creatures;
std::map<int, std::vector<MissilePtr> > m_missilesAtFloor;
std::array<std::vector<MissilePtr>, MAX_Z> m_missilesAtFloor;
Light m_light;
Position m_centralPosition;