+void Interpreter::ReadFont(Font &f, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "sprite") {
+ f.SetSprite(GetSprite(*i->second));
+ } else if (i->first == "columnoffset") {
+ f.SetColOffset(GetNumber(*i->second));
+ } else if (i->first == "rowoffset") {
+ f.SetRowOffset(GetNumber(*i->second));
+ } else {
+ throw Error("unknown Font property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadFrame(Frame &f, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "image") {
+ f.SetSurface(GetImage(*i->second));
+ } else if (i->first == "border") {
+ f.SetBorderSize(GetVector(*i->second));
+ } else if (i->first == "repeat") {
+ f.SetRepeatSize(GetVector(*i->second));
+ } else if (i->first == "offset") {
+ f.SetOffset(GetVector(*i->second));
+ } else {
+ throw Error("unknown Frame property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadGauge(Gauge &g, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "image") {
+ g.SetSurface(GetImage(*i->second));
+ } else if (i->first == "full") {
+ g.SetFullOffset(GetVector(*i->second));
+ } else if (i->first == "empty") {
+ g.SetEmptyOffset(GetVector(*i->second));
+ } else if (i->first == "height") {
+ g.SetHeight(GetNumber(*i->second));
+ } else if (i->first == "start") {
+ g.SetStartWidth(GetNumber(*i->second));
+ } else if (i->first == "repeat") {
+ g.SetRepeatWidth(GetNumber(*i->second));
+ } else if (i->first == "end") {
+ g.SetEndWidth(GetNumber(*i->second));
+ } else {
+ throw Error("unknown Gauge property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadIkari(Ikari &ikari, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "name") {
+ ikari.SetName(GetString(*i->second));
+ } else if (i->first == "cost") {
+ ikari.SetCost(GetNumber(*i->second));
+ } else if (i->first == "targets") {
+ ikari.GetTargetingMode() = *GetTargetingMode(*i->second);
+ } else if (i->first == "magical") {
+ if (GetBoolean(*i->second)) {
+ ikari.SetMagical();
+ }
+ } else if (i->first == "physical") {
+ if (GetBoolean(*i->second)) {
+ ikari.SetPhysical();
+ }
+ } else {
+ throw Error("unknown Ikari property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadItem(Item &item, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "name") {
+ item.SetName(GetString(*i->second));
+ } else if (i->first == "menuicon") {
+ item.SetMenuIcon(GetSprite(*i->second));
+ } else if (i->first == "battle") {
+ if (GetBoolean(*i->second)) {
+ item.SetUsableInBattle();
+ }
+ } else if (i->first == "targets") {
+ item.GetTargetingMode() = *GetTargetingMode(*i->second);
+ } else if (i->first == "ikari") {
+ item.SetIkari(GetIkari(*i->second));
+ } else if (i->first == "attackanimation") {
+ item.SetAttackAnimation(GetAnimation(*i->second));
+ } else {
+ throw Error("unknown Item property: " + i->first);
+ }
+ }
+}
+