X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FInterpreter.h;h=9e90bcc4e98fd51d9f7b05594308b689a6df3d01;hb=2a1d9169e1f6c2dfe0f93ed40d5fb68d3da342af;hp=3202482d3d9a1e28e2a8c67ddb9a3ea181938356;hpb=44e43987d774b65dffbeae7692606eb2f82de531;p=l2e.git diff --git a/src/loader/Interpreter.h b/src/loader/Interpreter.h index 3202482..9e90bcc 100644 --- a/src/loader/Interpreter.h +++ b/src/loader/Interpreter.h @@ -8,50 +8,25 @@ #ifndef LOADER_INTERPRETER_H_ #define LOADER_INTERPRETER_H_ +#include "fwd.h" +#include "ParsedSource.h" #include "TypeDescription.h" +#include "../battle/fwd.h" +#include "../common/fwd.h" #include "../geometry/Vector.h" #include "../graphics/Color.h" #include "../graphics/ComplexAnimation.h" +#include "../graphics/fwd.h" #include +#include #include #include #include #include -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 { public: @@ -61,7 +36,7 @@ public: }; public: - Interpreter(const ParsedSource &source) : source(source) { } + explicit Interpreter(const ParsedSource &source) : source(source) { } ~Interpreter(); private: Interpreter(const Interpreter &); @@ -72,17 +47,29 @@ public: void *GetObject(int typeId, const std::string &name); static void CreateTypeDescriptions(); + struct ParsedDefinition { + ParsedDefinition(const Definition *dfn, int type, int id) + : dfn(dfn), type(type), id(id) { } + const Definition *dfn; + int type; + int id; + }; 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) { } + PostponedDefinition(int type, int id, std::ptrdiff_t offset, const char *identifier, int linkedType, bool inlined) + : type(type), id(id), offset(offset), identifier(identifier), linkedType(linkedType), inlined(inlined) { } int type; int id; std::ptrdiff_t offset; const char *identifier; int linkedType; + bool inlined; }; - const std::vector &PostponedDefinitions() { return postponedDefinitions; } + const std::set &ExportedIdentifiers() const { return source.Exports(); } + const ParsedDefinition &GetDefinition(const std::string &identifier) const; + const std::map &Images() const { return imageCache; } + const std::vector &PostponedDefinitions() const { return postponedDefinitions; } + const std::map > &Values() const { return values; } private: void ReadDefinition(const Definition &); @@ -95,23 +82,15 @@ private: SDL_Surface *GetImage(const std::string &); + bool CanLink(const Value &) const; + void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType, bool inlined); + private: const ParsedSource &source; - 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 parsedDefinitions; - bool CanLink(const Value &) const; - void Postpone(int type, int id, std::ptrdiff_t offset, const std::string &identifier, int linkedType); + std::map parsedDefinitions; std::vector postponedDefinitions; - std::map imageCache; - std::map > values; };