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; return;
if(MissilePtr shot = thing->asMissile()) { if(MissilePtr shot = thing->asMissile()) {
m_missilesAtFloor[shot->getPosition().z]; auto it = std::find(m_missilesAtFloor[shot->getPosition().z].begin(), m_missilesAtFloor[shot->getPosition().z].end(), shot);
for(auto it = m_missilesAtFloor[shot->getPosition().z].begin(), end = m_missilesAtFloor[shot->getPosition().z].end(); it != end; ++it) { if(it != m_missilesAtFloor[shot->getPosition().z].end()) {
if(shot == *it) {
m_missilesAtFloor[shot->getPosition().z].erase(it); m_missilesAtFloor[shot->getPosition().z].erase(it);
break;
}
} }
return; return;
} }

View File

@ -69,7 +69,7 @@ public:
private: private:
std::unordered_map<Position, TilePtr, PositionHasher> m_tiles; std::unordered_map<Position, TilePtr, PositionHasher> m_tiles;
std::map<uint32, CreaturePtr> m_creatures; 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; Light m_light;
Position m_centralPosition; Position m_centralPosition;