X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.h;h=aea5fbe85712433c963cf5f1aeb8016f59fdbc0b;hb=1ad6b01c2cac5f771fcef0911c6d81230e50d0ed;hp=9ba5924a8ab85173e4967c167cc6a62ac6139149;hpb=05112fcfdbd0c452c80b6786bf6121d6f63b852a;p=l2e.git diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index 9ba5924..aea5fbe 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -12,7 +12,6 @@ #include "../graphics/ComplexAnimation.h" #include -#include #include #include #include @@ -47,7 +46,7 @@ public: public: Interpreter(const ParsedSource &source) : source(source) { } - ~Interpreter() { } + ~Interpreter(); private: Interpreter(const Interpreter &); Interpreter &operator =(const Interpreter &); @@ -55,6 +54,13 @@ private: public: void ReadSource(); +public: + graphics::Animation *GetAnimation(const std::string &name); + battle::Hero *GetHero(const std::string &name); + battle::Monster *GetMonster(const std::string &name); + int GetNumber(const std::string &name) const; + graphics::Sprite *GetSprite(const std::string &name); + private: void ReadDefinition(const Definition &); void ReadLiteral(const Definition &); @@ -81,13 +87,31 @@ private: private: const ParsedSource &source; - std::set parsedDefinitions; - - std::map animations; - std::map heroes; - std::map monsters; - std::map numbers; - std::map sprites; + enum DynamicType { + ANIMATION, + COMPLEX_ANIMATION, + HERO, + MONSTER, + NUMBER, + SIMPLE_ANIMATION, + SPRITE, + }; + struct ParsedDefinition { + ParsedDefinition(const Definition *dfn, DynamicType type, int index) + : dfn(dfn), type(type), index(index) { } + bool IsCompatible(DynamicType with) const; + const Definition *dfn; + DynamicType type; + int index; + }; + std::map parsedDefinitions; + + std::vector animations; + std::vector heroes; + std::vector images; + std::vector monsters; + std::vector numbers; + std::vector sprites; };