+ m.SetName(GetString(*i->second));
+ } else if (i->first == "sprite") {
+ m.SetSprite(GetSprite(*i->second));
+ } else if (i->first == "level") {
+ m.SetLevel(GetNumber(*i->second));
+ } else if (i->first == "maxHealth") {
+ m.SetMaxHealth(GetNumber(*i->second));
+ } else if (i->first == "health") {
+ m.SetHealth(GetNumber(*i->second));
+ } else if (i->first == "maxMana") {
+ m.SetMaxMana(GetNumber(*i->second));
+ } else if (i->first == "mana") {
+ m.SetMana(GetNumber(*i->second));
+ } else if (i->first == "stats") {
+ battle::Stats stats;
+ ReadStats(stats, *GetPropertyList(*i->second));
+ m.SetStats(stats);
+ } else if (i->first == "attackAnimation") {
+ m.SetAttackAnimation(GetAnimation(*i->second));
+ } else {
+ throw Error("unknown Monster property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadSimpleAnimation(SimpleAnimation &a, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "sprite") {
+ a.SetSprite(GetSprite(*i->second));
+ } else if (i->first == "frametime") {
+ a.SetFrameTime(GetNumber(*i->second));
+ } else if (i->first == "repeat") {
+ a.SetRepeat(GetBoolean(*i->second));
+ } else if (i->first == "framecount") {
+ a.SetNumFrames(GetNumber(*i->second));
+ } else if (i->first == "col") {
+ a.SetCol(GetNumber(*i->second));
+ } else if (i->first == "row") {
+ a.SetRow(GetNumber(*i->second));
+ } else {
+ throw Error("unknown SimpleAnimation property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadSprite(Sprite &s, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "image") {
+ s.SetSurface(GetImage(*i->second));
+ } else if (i->first == "size") {
+ s.SetSize(GetVector(*i->second));
+ } else if (i->first == "offset") {
+ s.SetOffset(GetVector(*i->second));
+ } else {
+ throw Error("unknown Sprite property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadStats(Stats &s, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "atp") {
+ s.SetAttack(GetNumber(*i->second));
+ } else if (i->first == "dfp") {
+ s.SetDefense(GetNumber(*i->second));
+ } else if (i->first == "str") {
+ s.SetStrength(GetNumber(*i->second));
+ } else if (i->first == "agl") {
+ s.SetAgility(GetNumber(*i->second));
+ } else if (i->first == "int") {
+ s.SetIntelligence(GetNumber(*i->second));
+ } else if (i->first == "gut") {
+ s.SetGut(GetNumber(*i->second));
+ } else if (i->first == "mgr") {
+ s.SetMagicResistance(GetNumber(*i->second));