fix crash

This commit is contained in:
Eduardo Bart 2011-08-16 09:58:49 -03:00
parent 758b4b5dfb
commit e51c29702c
1 changed files with 12 additions and 8 deletions

View File

@ -13,15 +13,19 @@ Effect::Effect() : Thing(THING_EFFECT)
void Effect::draw(int x, int y) void Effect::draw(int x, int y)
{ {
if(!m_finished && g_platform.getTicks() - m_lastTicks > 75) { if(!m_finished) {
const ThingAttributes& attributes = getAttributes(); if(g_platform.getTicks() - m_lastTicks > 75) {
m_animation++; const ThingAttributes& attributes = getAttributes();
if(m_animation == attributes.animcount) m_animation++;
g_dispatcher.addEvent(std::bind(&Map::removeThing, &g_map, asThing())); if(m_animation == attributes.animcount) {
m_lastTicks = g_platform.getTicks(); g_dispatcher.addEvent(std::bind(&Map::removeThing, &g_map, asThing()));
} m_finished = true;
}
m_lastTicks = g_platform.getTicks();
}
internalDraw(x, y, 0, 0, 0, 0, m_animation); internalDraw(x, y, 0, 0, 0, 0, m_animation);
}
} }
const ThingAttributes& Effect::getAttributes() const ThingAttributes& Effect::getAttributes()