From e51c29702c459eb80b98b9cfa2724587bf696d30 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 16 Aug 2011 09:58:49 -0300 Subject: [PATCH] fix crash --- src/otclient/core/effect.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/otclient/core/effect.cpp b/src/otclient/core/effect.cpp index ae20aa3f..4ae5b4e5 100644 --- a/src/otclient/core/effect.cpp +++ b/src/otclient/core/effect.cpp @@ -13,15 +13,19 @@ Effect::Effect() : Thing(THING_EFFECT) void Effect::draw(int x, int y) { - if(!m_finished && g_platform.getTicks() - m_lastTicks > 75) { - const ThingAttributes& attributes = getAttributes(); - m_animation++; - if(m_animation == attributes.animcount) - g_dispatcher.addEvent(std::bind(&Map::removeThing, &g_map, asThing())); - m_lastTicks = g_platform.getTicks(); - } + if(!m_finished) { + if(g_platform.getTicks() - m_lastTicks > 75) { + const ThingAttributes& attributes = getAttributes(); + m_animation++; + if(m_animation == attributes.animcount) { + 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()