+/*
+ * Caster.cpp
+ *
+ * Created on: Sep 19, 2012
+ * Author: holy
+ */
+
+#include "Caster.h"
+
+#include "TypeDescription.h"
+
+using battle::Hero;
+using battle::Monster;
+using battle::PartyLayout;
+using common::Item;
+using common::Spell;
+using std::string;
+
+
+namespace loader {
+
+Caster::Caster(Interpreter &intp)
+: intp(intp)
+, battleResourcesId(TypeDescription::GetTypeId("BattleResources"))
+, heroId(TypeDescription::GetTypeId("Hero"))
+, itemId(TypeDescription::GetTypeId("Item"))
+, monsterId(TypeDescription::GetTypeId("Monster"))
+, partyLayoutId(TypeDescription::GetTypeId("PartyLayout"))
+, spellId(TypeDescription::GetTypeId("Spell")) {
+
+}
+
+
+battle::Resources *Caster::GetBattleResources(const string &ident) {
+ return reinterpret_cast<battle::Resources *>(intp.GetObject(battleResourcesId, ident));
+}
+
+Hero *Caster::GetHero(const string &ident) {
+ return reinterpret_cast<Hero *>(intp.GetObject(heroId, ident));
+}
+
+Item *Caster::GetItem(const string &ident) {
+ return reinterpret_cast<Item *>(intp.GetObject(itemId, ident));
+}
+
+Monster *Caster::GetMonster(const string &ident) {
+ return reinterpret_cast<Monster *>(intp.GetObject(monsterId, ident));
+}
+
+PartyLayout *Caster::GetPartyLayout(const string &ident) {
+ return reinterpret_cast<PartyLayout *>(intp.GetObject(partyLayoutId, ident));
+}
+
+Spell *Caster::GetSpell(const string &ident) {
+ return reinterpret_cast<Spell *>(intp.GetObject(spellId, ident));
+}
+
+}