- for (vector<ComplexAnimation *>::const_iterator i(complexAnimations.begin()), end(complexAnimations.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Font *>::const_iterator i(fonts.begin()), end(fonts.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Frame *>::const_iterator i(frames.begin()), end(frames.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Gauge *>::const_iterator i(gauges.begin()), end(gauges.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Hero *>::const_iterator i(heroes.begin()), end(heroes.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Ikari *>::const_iterator i(ikaris.begin()), end(ikaris.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<SDL_Surface *>::const_iterator i(images.begin()), end(images.end()); i != end; ++i) {
- SDL_FreeSurface(*i);
- }
- for (vector<Item *>::const_iterator i(items.begin()), end(items.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<graphics::MenuProperties *>::const_iterator i(menuProperties.begin()), end(menuProperties.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Monster *>::const_iterator i(monsters.begin()), end(monsters.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<PartyLayout *>::const_iterator i(partyLayouts.begin()), end(partyLayouts.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<SimpleAnimation *>::const_iterator i(simpleAnimations.begin()), end(simpleAnimations.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Spell *>::const_iterator i(spells.begin()), end(spells.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<Sprite *>::const_iterator i(sprites.begin()), end(sprites.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<const char *>::const_iterator i(strings.begin()), end(strings.end()); i != end; ++i) {
- delete *i;
- }
- for (vector<TargetingMode *>::const_iterator i(targetingModes.begin()), end(targetingModes.end()); i != end; ++i) {
- delete *i;
- }
-}
-
-
-Animation *Interpreter::GetAnimation(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == COMPLEX_ANIMATION) {
- return complexAnimations[i->second.index];
- } else if (i->second.type == SIMPLE_ANIMATION) {
- return simpleAnimations[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Animation");
- }
- } else {
- throw Error("access to undefined Animation " + name);
- }
-}
-
-bool Interpreter::GetBoolean(const std::string &name) const {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == BOOLEAN) {
- return booleans[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Boolean");
- }
- } else {
- throw Error("access to undefined Boolean " + name);
- }
-}
-
-const Color &Interpreter::GetColor(const std::string &name) const {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == COLOR) {
- return colors[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Color");
- }
- } else {
- throw Error("access to undefined Color " + name);
- }
-}
-
-Font *Interpreter::GetFont(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == FONT) {
- return fonts[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Font");
- }
- } else {
- throw Error("access to undefined Font " + name);
- }
-}
-
-Frame *Interpreter::GetFrame(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == FRAME) {
- return frames[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Frame");
- }
- } else {
- throw Error("access to undefined Frame " + name);
- }
-}
-
-Gauge *Interpreter::GetGauge(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == GAUGE) {
- return gauges[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Gauge");
- }
- } else {
- throw Error("access to undefined Gauge " + name);
- }
-}
-
-Hero *Interpreter::GetHero(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == HERO) {
- return heroes[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Hero");
- }
- } else {
- throw Error("access to undefined Hero " + name);
- }
-}
-
-Ikari *Interpreter::GetIkari(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == IKARI) {
- return ikaris[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Ikari");
- }
- } else {
- throw Error("access to undefined Ikari " + name);
- }
-}
-
-Item *Interpreter::GetItem(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == ITEM) {
- return items[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Item");
- }
- } else {
- throw Error("access to undefined Item " + name);
- }
-}
-
-graphics::MenuProperties *Interpreter::GetMenuProperties(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == MENU_PROPERTIES) {
- return menuProperties[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to MenuProperties");
- }
- } else {
- throw Error("access to undefined MenuProperties " + name);
- }
-}
-
-Monster *Interpreter::GetMonster(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == MONSTER) {
- return monsters[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Monster");
- }
- } else {
- throw Error("access to undefined Monster " + name);
- }
-}
-
-int Interpreter::GetNumber(const std::string &name) const {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == NUMBER) {
- return numbers[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to Number");
- }
- } else {
- throw Error("access to undefined Number " + name);
- }
-}
-
-PartyLayout *Interpreter::GetPartyLayout(const std::string &name) {
- map<string, ParsedDefinition>::const_iterator i(parsedDefinitions.find(name));
- if (i != parsedDefinitions.end()) {
- if (i->second.type == PARTY_LAYOUT) {
- return partyLayouts[i->second.index];
- } else {
- throw Error("cannot cast " + i->second.dfn->TypeName() + " to PartyLayout");
- }
- } else {
- throw Error("access to undefined PartyLayout " + name);