effect fix, spr assert

This commit is contained in:
Henrique 2011-08-16 10:25:21 -03:00
parent 7d419d49e4
commit d4244be464
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -93,7 +93,7 @@ TexturePtr SpriteManager::getSpriteTexture(int id)
if(id == 0) if(id == 0)
return g_graphics.getEmptyTexture(); return g_graphics.getEmptyTexture();
assert(id <= m_spritesCount); assert(id > 0 && id <= m_spritesCount);
// load sprites on demand // load sprites on demand
TexturePtr texture = m_sprites[id-1]; TexturePtr texture = m_sprites[id-1];