]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/Interpreter.h
split reading of literal from reading its defined name
[l2e.git] / src / loader / Interpreter.h
index c2fc25f84b6a1b6cb09edf1492e046f1e13c50d2..8d5c1e31aadf7ca70ad042501baa2317d074fbd3 100644 (file)
@@ -8,20 +8,49 @@
 #ifndef LOADER_INTERPRETER_H_
 #define LOADER_INTERPRETER_H_
 
+#include "TypeDescription.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Color.h"
+#include "../graphics/ComplexAnimation.h"
+
 #include <map>
 #include <stdexcept>
 #include <string>
 #include <vector>
+#include <SDL.h>
 
 namespace battle {
+       class Hero;
        class Monster;
+       class PartyLayout;
+       struct Resources;
+       class Stats;
+}
+
+namespace common {
+       class Ikari;
+       class Item;
+       class Spell;
+       class TargetingMode;
+}
+
+namespace graphics {
+       class Animation;
+       class Font;
+       class Frame;
+       class Gauge;
+       struct MenuProperties;
+       class SimpleAnimation;
+       class Sprite;
 }
 
 namespace loader {
 
 class Definition;
+class Literal;
 class ParsedSource;
 class PropertyList;
+class Value;
 
 class Interpreter {
 
@@ -33,23 +62,55 @@ public:
 
 public:
        Interpreter(const ParsedSource &source) : source(source) { }
-       ~Interpreter() { }
+       ~Interpreter();
 private:
        Interpreter(const Interpreter &);
        Interpreter &operator =(const Interpreter &);
 
 public:
        void ReadSource();
+       void *GetObject(int typeId, const std::string &name);
+
+       static void CreateTypeDescriptions();
+       struct PostponedDefinition {
+               PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType)
+               : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType) { }
+               int type;
+               int id;
+               std::ptrdiff_t offset;
+               const char *identifier;
+               int linkedType;
+       };
+
+       const std::vector<PostponedDefinition> &PostponedDefinitions() { return postponedDefinitions; }
 
 private:
+       void ReadDefinition(const Definition &);
        void ReadLiteral(const Definition &);
        void ReadObject(const Definition &);
 
-       void ReadMonster(battle::Monster &, const PropertyList &);
+       void ReadLiteral(int typeId, int id, char *dest, const Literal &);
+       void *GetObject(int typeId, const Value &value);
+       void ReadObject(int typeId, int id, char *dest, const PropertyList &);
 
 private:
        const ParsedSource &source;
-       std::vector<battle::Monster> monsters;
+       struct ParsedDefinition {
+               ParsedDefinition(const Definition *dfn, int type, int id)
+               : dfn(dfn), type(type), id(id) { }
+               const Definition *dfn;
+               int type;
+               int id;
+       };
+       std::map<std::string, ParsedDefinition> parsedDefinitions;
+
+       bool CanLink(const Value &) const;
+       void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType);
+       std::vector<PostponedDefinition> postponedDefinitions;
+
+       std::map<std::string, SDL_Surface *> imageCache;
+
+       std::map<int, std::vector<void *> > values;
 
 };