From 4789ebb11407eb9402c385f3cc6fa242d91214c2 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 24 Jul 2006 00:13:24 +0000 Subject: Implemented caching of spritesets, including a lot of cleanups to the new animation system. Action now refers to the Spriteset directly and AnimatedSprite refers to the current Action directly instead of using the std::map with a std::string constantly. Some methods and parameters are marked as const. The READ_PROP macro was replaced by static methods. Warnings are logged when unnamed actions are defined or when actions refer to undefined imagesets. Code is more tolerant towards missing actions. --- src/being.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index d34ea43e..437023d4 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -28,7 +28,7 @@ #include "log.h" #include "map.h" -#include "graphic/spriteset.h" +#include "resources/spriteset.h" #include "gui/gui.h" @@ -65,9 +65,12 @@ Being::Being(Uint32 id, Uint16 job, Map *map): Being::~Being() { - for (int i =0; i < VECTOREND_SPRITE; i++) + for (int i = 0; i < VECTOREND_SPRITE; i++) { - delete mSprites[i]; + if (mSprites[i] != NULL) + { + delete mSprites[i]; + } } clearPath(); @@ -266,7 +269,6 @@ Being::setDirection(Uint8 direction) { if (mSprites[i] != NULL) mSprites[i]->setDirection(dir); } - } void -- cgit v1.2.3-60-g2f50