Fix minimap tile update for item removal

This commit is contained in:
Ahmed Samy 2013-12-18 04:38:18 +02:00
parent 863bece70b
commit ad7cda534d
2 changed files with 9 additions and 7 deletions

View File

@ -149,6 +149,8 @@ public:
bool isNull() { return m_null; } bool isNull() { return m_null; }
bool isWriteable() { return m_attribs.get<bool>(ItemTypeAttrWritable); }
private: private:
ItemCategory m_category; ItemCategory m_category;
stdext::boolean<true> m_null; stdext::boolean<true> m_null;

View File

@ -180,34 +180,34 @@ bool Map::removeThing(const ThingPtr& thing)
if(!thing) if(!thing)
return false; return false;
notificateTileUpdate(thing->getPosition()); bool ret = false;
if(thing->isMissile()) { if(thing->isMissile()) {
MissilePtr missile = thing->static_self_cast<Missile>(); MissilePtr missile = thing->static_self_cast<Missile>();
int z = missile->getPosition().z; int z = missile->getPosition().z;
auto it = std::find(m_floorMissiles[z].begin(), m_floorMissiles[z].end(), missile); auto it = std::find(m_floorMissiles[z].begin(), m_floorMissiles[z].end(), missile);
if(it != m_floorMissiles[z].end()) { if(it != m_floorMissiles[z].end()) {
m_floorMissiles[z].erase(it); m_floorMissiles[z].erase(it);
return true; ret = true;
} }
} else if(thing->isAnimatedText()) { } else if(thing->isAnimatedText()) {
AnimatedTextPtr animatedText = thing->static_self_cast<AnimatedText>(); AnimatedTextPtr animatedText = thing->static_self_cast<AnimatedText>();
auto it = std::find(m_animatedTexts.begin(), m_animatedTexts.end(), animatedText); auto it = std::find(m_animatedTexts.begin(), m_animatedTexts.end(), animatedText);
if(it != m_animatedTexts.end()) { if(it != m_animatedTexts.end()) {
m_animatedTexts.erase(it); m_animatedTexts.erase(it);
return true; ret = true;
} }
} else if(thing->isStaticText()) { } else if(thing->isStaticText()) {
StaticTextPtr staticText = thing->static_self_cast<StaticText>(); StaticTextPtr staticText = thing->static_self_cast<StaticText>();
auto it = std::find(m_staticTexts.begin(), m_staticTexts.end(), staticText); auto it = std::find(m_staticTexts.begin(), m_staticTexts.end(), staticText);
if(it != m_staticTexts.end()) { if(it != m_staticTexts.end()) {
m_staticTexts.erase(it); m_staticTexts.erase(it);
return true; ret = true;
} }
} else if(const TilePtr& tile = thing->getTile()) } else if(const TilePtr& tile = thing->getTile())
return tile->removeThing(thing); ret = tile->removeThing(thing);
return false; notificateTileUpdate(thing->getPosition());
return ret;
} }
bool Map::removeThingByPos(const Position& pos, int stackPos) bool Map::removeThingByPos(const Position& pos, int stackPos)