diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-03 20:06:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-03 20:18:49 +0300 |
commit | 98c10803f79ce9decb4a431719e18bb27aac4485 (patch) | |
tree | cbe6325a1e2deafe38170565a0c1d9c3f5cb7faa /src/resources | |
parent | 57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534 (diff) | |
download | manaplus-98c10803f79ce9decb4a431719e18bb27aac4485.tar.gz manaplus-98c10803f79ce9decb4a431719e18bb27aac4485.tar.bz2 manaplus-98c10803f79ce9decb4a431719e18bb27aac4485.tar.xz manaplus-98c10803f79ce9decb4a431719e18bb27aac4485.zip |
Improve a bit animation speed.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/animation.h | 27 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 2 |
2 files changed, 8 insertions, 21 deletions
diff --git a/src/resources/animation.h b/src/resources/animation.h index 1d23b1608..ffa717f8c 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -58,6 +58,10 @@ struct Frame */ class Animation { + friend class AnimatedSprite; + friend class ParticleEmitter; + friend class SimpleAnimation; + public: Animation(); @@ -74,28 +78,10 @@ class Animation void addTerminator(int rand); /** - * Returns the frame at the specified index. - */ - Frame *getFrame(int index) - { return &(mFrames[index]); } - - /** * Returns the length of this animation in frames. */ - unsigned int getLength() const - { return static_cast<unsigned>(mFrames.size()); } - - /** - * Check for empty animation. - */ - bool empty() const - { return mFrames.empty(); } - - /** - * Returns the duration of this animation. - */ - int getDuration() const - { return mDuration; } + size_t getLength() const + { return mFrames.size(); } void addJump(std::string name, int rand); @@ -113,6 +99,7 @@ class Animation static bool isTerminator(const Frame &phase); protected: + typedef std::vector<Frame> Frames; typedef Frames::iterator FramesIter; typedef Frames::reverse_iterator FramesRevIter; diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 3f1ef1239..fd04f015f 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -777,7 +777,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, if (ani->getLength() > 0) { map->addAnimation(tileGID, new TileAnimation(ani)); - logger->log("Animation length: %d", ani->getLength()); +// logger->log("Animation length: %d", ani->getLength()); } else { |