diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 13 | ||||
-rw-r--r-- | src/gui/viewport.h | 15 | ||||
-rw-r--r-- | src/resources/animation.h | 2 | ||||
-rw-r--r-- | src/simpleanimation.h | 20 |
5 files changed, 34 insertions, 18 deletions
@@ -2,6 +2,8 @@ * src/gui/sell.cpp, src/gui/buy.cpp, src/being.cpp: A bunch of lingering syntactical changes. + * src/gui/viewport.cpp: Added a missing include and fixed a bug with + cleaning up target cursor animations. 2007-05-23 Philipp Sehmisch <tmw@crushnet.org> diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index cc020ca7..c1a904f5 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -46,6 +46,8 @@ #include "../utils/tostring.h" +#include <cassert> + Viewport::Viewport(): mMap(0), mViewX(0.0f), @@ -83,8 +85,8 @@ Viewport::Viewport(): } void -Viewport::loadTargetCursor (std::string filename, int width, int height, - bool outRange, Being::TargetCursorSize size) +Viewport::loadTargetCursor(std::string filename, int width, int height, + bool outRange, Being::TargetCursorSize size) { assert(size > -1); assert(size < 3); @@ -117,11 +119,10 @@ Viewport::~Viewport() { delete mPopupMenu; - delete[] mTargetCursorInRange; - delete[] mTargetCursorOutRange; - for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++) { + delete mTargetCursorInRange[i]; + delete mTargetCursorOutRange[i]; mInRangeImages[i]->decRef(); mOutRangeImages[i]->decRef(); } @@ -288,7 +289,7 @@ Viewport::logic() mWalkTime = player_node->mWalkTime; } - for(int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { mTargetCursorInRange[i]->update(10); mTargetCursorOutRange[i]->update(10); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index a0f69407..22d0f249 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -171,10 +171,17 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int mCameraY; /**< Current viewpoint in tiles. */ bool mShowDebugPath; /**< Show a path from player to pointer. */ - ImageSet *mInRangeImages[Being::NUM_TC]; /**< Images of in range target cursor. */ - ImageSet *mOutRangeImages[Being::NUM_TC]; /**< Images of out of range target cursor.*/ - SimpleAnimation *mTargetCursorInRange[Being::NUM_TC]; /**< Animated in range target cursor. */ - SimpleAnimation *mTargetCursorOutRange[Being::NUM_TC];/**< Animated out of range target cursor. */ + /** Images of in range target cursor. */ + ImageSet *mInRangeImages[Being::NUM_TC]; + + /** Images of out of range target cursor. */ + ImageSet *mOutRangeImages[Being::NUM_TC]; + + /** Animated in range target cursor. */ + SimpleAnimation *mTargetCursorInRange[Being::NUM_TC]; + + /** Animated out of range target cursor. */ + SimpleAnimation *mTargetCursorOutRange[Being::NUM_TC]; bool mPlayerFollowMouse; int mWalkTime; diff --git a/src/resources/animation.h b/src/resources/animation.h index d0d11c69..aad93cda 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -54,7 +54,7 @@ class Animation Animation(); /** - * Appends a new animation at the end of the sequence + * Appends a new animation at the end of the sequence. */ void addFrame(Image *image, unsigned int delay, int offsetX, int offsetY); diff --git a/src/simpleanimation.h b/src/simpleanimation.h index 14793c2f..561c540d 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -38,9 +38,8 @@ class Graphics; class SimpleAnimation { public: - /** - * Creates a simple animation with an already created animation + * Creates a simple animation with an already created animation. */ SimpleAnimation(Animation *animation): mAnimation(animation), @@ -50,7 +49,7 @@ class SimpleAnimation {}; /** - * Creates a simple animation that creates its animation from XML Data + * Creates a simple animation that creates its animation from XML Data. */ SimpleAnimation(xmlNodePtr animationNode); @@ -61,10 +60,17 @@ class SimpleAnimation Image *getCurrentImage() const; private: - Animation *mAnimation; /**< The hosted animation */ - unsigned int mAnimationTime; /**< Time in game ticks the current frame is shown*/ - unsigned int mAnimationPhase; /**< Index of current animation phase*/ - Frame *mCurrentFrame; /**< Current animation phase */ + /** The hosted animation. */ + Animation *mAnimation; + + /** Time in game ticks the current frame is shown. */ + unsigned int mAnimationTime; + + /** Index of current animation phase. */ + unsigned int mAnimationPhase; + + /** Current animation phase. */ + Frame *mCurrentFrame; }; #endif |