#ifndef LOADER_INTERPRETER_H_
#define LOADER_INTERPRETER_H_
+#include "../geometry/Vector.h"
+#include "../graphics/ComplexAnimation.h"
+
#include <map>
+#include <set>
#include <stdexcept>
#include <string>
#include <vector>
+#include <SDL.h>
namespace battle {
+ class Hero;
class Monster;
+ class Stats;
+}
+
+namespace graphics {
+ class Animation;
+ class SimpleAnimation;
+ class Sprite;
}
namespace loader {
class Definition;
class ParsedSource;
class PropertyList;
+class Value;
class Interpreter {
void ReadSource();
private:
+ void ReadDefinition(const Definition &);
void ReadLiteral(const Definition &);
void ReadObject(const Definition &);
+ graphics::Animation *GetAnimation(const Value &);
+ const std::vector<Value *> &GetValueArray(const Value &);
+ const std::vector<PropertyList *> &GetPropertyListArray(const Value &);
+ bool GetBoolean(const Value &);
+ SDL_Surface *GetImage(const Value &);
+ int GetNumber(const Value &);
+ const PropertyList *GetPropertyList(const Value &);
+ graphics::Sprite *GetSprite(const Value &);
+ const char *GetString(const Value &);
+ geometry::Vector<int> GetVector(const Value &);
+
+ void ReadComplexAnimation(graphics::ComplexAnimation &, const PropertyList &);
+ void ReadComplexAnimationFrame(graphics::ComplexAnimation::FrameProp &, const PropertyList &);
+ void ReadHero(battle::Hero &, const PropertyList &);
void ReadMonster(battle::Monster &, const PropertyList &);
+ void ReadSimpleAnimation(graphics::SimpleAnimation &, const PropertyList &);
+ void ReadSprite(graphics::Sprite &, const PropertyList &);
+ void ReadStats(battle::Stats &, const PropertyList &);
private:
const ParsedSource &source;
- std::vector<battle::Monster> monsters;
+ std::set<std::string> parsedDefinitions;
+
+ std::map<std::string, graphics::Animation *> animations;
+ std::map<std::string, battle::Hero *> heroes;
+ std::map<std::string, battle::Monster *> monsters;
+ std::map<std::string, int> numbers;
+ std::map<std::string, graphics::Sprite *> sprites;
};