Browse Source

THe animator would break the Map system. Reverting.

Eiyeron Fulmincendii 10 years ago
parent
commit
25aad7c873
2 changed files with 3 additions and 7 deletions
  1. 1 5
      src/render/Animator.cpp
  2. 2 2
      src/render/Animator.h

+ 1 - 5
src/render/Animator.cpp

@@ -1,5 +1,4 @@
 #include "Animator.h"
-#include <stdio.h>
 
 #define ANIMATOR WalrusRPG::Animator
 
@@ -49,13 +48,10 @@ ANIMATOR::Animator()
     elapsed_time = 0;
 }
 
-unsigned ANIMATOR::add_animation(Animation anim)
+void ANIMATOR::add_animation(int index, Animation anim)
 {
-    animations.push_back(anim);
-    unsigned index = animations.size()-1;
     animations[index] = anim;
     animations[index].duration = get_animation_duration(anim);
-    return animations.size();
 }
 
 unsigned ANIMATOR::get_animation_frame(unsigned id)

+ 2 - 2
src/render/Animator.h

@@ -21,7 +21,7 @@ namespace WalrusRPG
     class Animator
     {
       public:
-        tinystl::vector<Animation> animations;
+        tinystl::unordered_map<unsigned, Animation> animations;
 
 
       protected:
@@ -29,7 +29,7 @@ namespace WalrusRPG
 
       public:
         Animator();
-        unsigned add_animation(Animation anim);
+        void add_animation(int index, Animation anim);
         void update(unsigned dt);
         unsigned get_animation_frame(unsigned id);
     };