diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 26ff7e96e..41977ad7e 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -492,11 +492,11 @@ void OMW::Engine::activate() MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr); boost::shared_ptr action = - MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr()); + ptr.getClass().activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr()); interpreterContext.activate (ptr, action); - std::string script = MWWorld::Class::get (ptr).getScript (ptr); + std::string script = ptr.getClass().getScript (ptr); MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayerPtr()); diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 16ab6321d..fe9368b44 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -108,7 +108,7 @@ namespace MWClass boost::shared_ptr Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const { - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfActivator"); diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index 550151e43..26d1cab6d 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -295,7 +295,7 @@ namespace MWClass return std::make_pair(0, "#{sInventoryMessage1}"); // slots that this item can be equipped in - std::pair, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); + std::pair, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr); if (slots_.first.empty()) return std::make_pair(0, ""); diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index ebc3b18e6..183d91ca1 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -61,7 +61,7 @@ namespace MWClass boost::shared_ptr Book::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 18a40d5d3..a174f69a7 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -233,7 +233,7 @@ namespace MWClass std::pair Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const { // slots that this item can be equipped in - std::pair, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); + std::pair, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr); if (slots_.first.empty()) return std::make_pair(0, ""); diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 2d9695c6b..62734c03d 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -112,7 +112,7 @@ namespace MWClass if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) return boost::shared_ptr (new MWWorld::NullAction ()); - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfContainer"); @@ -127,7 +127,7 @@ namespace MWClass const std::string trapActivationSound = "Disarm Trap Fail"; MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player); + MWWorld::InventoryStore& invStore = player.getClass().getInventoryStore(player); bool needKey = ptr.getCellRef().mLockLevel > 0; bool hasKey = false; @@ -143,7 +143,7 @@ namespace MWClass if (refId == keyId) { hasKey = true; - keyName = MWWorld::Class::get(*it).getName(*it); + keyName = it->getClass().getName(*it); } } diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 924021faa..7e484f9d4 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -277,7 +277,7 @@ namespace MWClass if (!weapon.isEmpty()) { - const bool weaphashealth = get(weapon).hasItemHealth(weapon); + const bool weaphashealth = weapon.getClass().hasItemHealth(weapon); const unsigned char *attack = NULL; if(type == ESM::Weapon::AT_Chop) attack = weapon.get()->mBase->mData.mChop; @@ -354,7 +354,7 @@ namespace MWClass } if(!object.isEmpty()) - getCreatureStats(ptr).setLastHitObject(MWWorld::Class::get(object).getId(object)); + getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object)); if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player") { @@ -444,7 +444,7 @@ namespace MWClass boost::shared_ptr Creature::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfCreature"); diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 06f0619ce..27903c410 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -99,7 +99,7 @@ namespace MWClass const std::string lockedSound = "LockedDoor"; const std::string trapActivationSound = "Disarm Trap Fail"; - MWWorld::ContainerStore &invStore = get(actor).getContainerStore(actor); + MWWorld::ContainerStore &invStore = actor.getClass().getContainerStore(actor); bool needKey = ptr.getCellRef().mLockLevel > 0; bool hasKey = false; @@ -115,7 +115,7 @@ namespace MWClass if (refId == keyId) { hasKey = true; - keyName = get(*it).getName(*it); + keyName = it->getClass().getName(*it); } } diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index e15424c38..ebe41bb53 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -153,7 +153,7 @@ namespace MWClass } MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player); int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); static const float fWortChanceValue = diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index bd25b66b2..1b28a8462 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -250,7 +250,7 @@ namespace MWClass std::pair Light::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const { - MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc); + MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc); MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if(weapon == invStore.end()) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 72505fa08..bca7708ea 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -484,10 +484,10 @@ namespace MWClass if(victim.isEmpty()) // Didn't hit anything return; - const MWWorld::Class &othercls = MWWorld::Class::get(victim); + const MWWorld::Class &othercls = victim.getClass(); if(!othercls.isActor()) // Can't hit non-actors return; - MWMechanics::CreatureStats &otherstats = victim.getClass().getCreatureStats(victim); + MWMechanics::CreatureStats &otherstats = othercls.getCreatureStats(victim); if(otherstats.isDead()) // Can't hit dead actors return; @@ -496,7 +496,7 @@ namespace MWClass int weapskill = ESM::Skill::HandToHand; if(!weapon.isEmpty()) - weapskill = get(weapon).getEquipmentSkill(weapon); + weapskill = weapon.getClass().getEquipmentSkill(weapon); float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill)); @@ -511,7 +511,7 @@ namespace MWClass MWMechanics::NpcStats &stats = getNpcStats(ptr); if(!weapon.isEmpty()) { - const bool weaphashealth = get(weapon).hasItemHealth(weapon); + const bool weaphashealth = weapon.getClass().hasItemHealth(weapon); const unsigned char *attack = NULL; if(type == ESM::Weapon::AT_Chop) attack = weapon.get()->mBase->mData.mChop; @@ -637,7 +637,7 @@ namespace MWClass } if(!object.isEmpty()) - getCreatureStats(ptr).setLastHitObject(get(object).getId(object)); + getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object)); if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player") { @@ -716,9 +716,9 @@ namespace MWClass inv.unequipItem(armor, ptr); if (ptr.getRefData().getHandle() == "player") - skillUsageSucceeded(ptr, get(armor).getEquipmentSkill(armor), 0); + skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0); - switch(get(armor).getEquipmentSkill(armor)) + switch(armor.getClass().getEquipmentSkill(armor)) { case ESM::Skill::LightArmor: sndMgr->playSound3D(ptr, "Light Armor Hit", 1.0f, 1.0f); @@ -802,7 +802,7 @@ namespace MWClass if(ptr.getRefData().getHandle() == "player") return boost::shared_ptr(new MWWorld::ActionTalk(actor)); - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfNPC"); @@ -814,7 +814,7 @@ namespace MWClass } if(getCreatureStats(ptr).isDead()) return boost::shared_ptr(new MWWorld::ActionOpen(ptr, true)); - if(get(ptr).getCreatureStats(ptr).isHostile()) + if(ptr.getClass().getCreatureStats(ptr).isHostile()) return boost::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak)) return boost::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing @@ -943,7 +943,7 @@ namespace MWClass if (fallHeight >= fallDistanceMin) { - const float acrobaticsSkill = MWWorld::Class::get(ptr).getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified(); + const float acrobaticsSkill = ptr.getClass().getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified(); const NpcCustomData *npcdata = static_cast(ptr.getRefData().getCustomData()); const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(ESM::MagicEffect::Jump).mMagnitude; const float fallAcroBase = gmst.find("fFallAcroBase")->getFloat(); @@ -1107,7 +1107,7 @@ namespace MWClass { MWWorld::LiveCellRef *ref = it->get(); - int armorSkillType = MWWorld::Class::get(*it).getEquipmentSkill(*it); + int armorSkillType = it->getClass().getEquipmentSkill(*it); int armorSkill = stats.getSkill(armorSkillType).getModified(); if(ref->mBase->mData.mWeight == 0) @@ -1177,7 +1177,7 @@ namespace MWClass if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name()) return "FootBareLeft"; - switch(Class::get(*boots).getEquipmentSkill(*boots)) + switch(boots->getClass().getEquipmentSkill(*boots)) { case ESM::Skill::LightArmor: return "FootLightLeft"; @@ -1204,7 +1204,7 @@ namespace MWClass if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name()) return "FootBareRight"; - switch(Class::get(*boots).getEquipmentSkill(*boots)) + switch(boots->getClass().getEquipmentSkill(*boots)) { case ESM::Skill::LightArmor: return "FootLightRight"; diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 216f815cd..f9d7947a6 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -133,7 +133,7 @@ namespace MWClass // hide effects the player doesnt know about MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player); int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); int i=0; static const float fWortChanceValue = diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index e9b0c8f3c..146251ca2 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -392,7 +392,7 @@ namespace MWClass if (ptr.getCellRef().mCharge == 0) return std::make_pair(0, "#{sInventoryMessage1}"); - std::pair, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr); + std::pair, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr); if (slots_.first.empty()) return std::make_pair (0, ""); diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index fe37f37ff..c7e832e4a 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -134,13 +134,13 @@ namespace MWDialogue mActor = actor; - MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor); + MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats (actor); mTalkedTo = creatureStats.hasTalkedToPlayer(); mActorKnownTopics.clear(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); - win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor)); + win->startDialogue(actor, actor.getClass().getName (actor)); //setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI updateTopics(); @@ -194,7 +194,7 @@ namespace MWDialogue Compiler::Locals locals; - std::string actorScript = MWWorld::Class::get (mActor).getScript (mActor); + std::string actorScript = mActor.getClass().getScript (mActor); if (!actorScript.empty()) { @@ -435,7 +435,7 @@ namespace MWDialogue // Apply disposition change to NPC's base disposition if (mActor.getClass().isNpc()) { - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mActor).getNpcStats(mActor); + MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor); npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange); } mPermanentDispositionChange = 0; diff --git a/apps/openmw/mwdialogue/filter.cpp b/apps/openmw/mwdialogue/filter.cpp index 8b9ee9184..067862345 100644 --- a/apps/openmw/mwdialogue/filter.cpp +++ b/apps/openmw/mwdialogue/filter.cpp @@ -25,7 +25,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const // actor id if (!info.mActor.empty()) { - if ( !Misc::StringUtils::ciEqual(info.mActor, MWWorld::Class::get (mActor).getId (mActor))) + if ( !Misc::StringUtils::ciEqual(info.mActor, mActor.getClass().getId (mActor))) return false; } else if (isCreature) @@ -64,7 +64,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const if (isCreature) return false; - MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor); + MWMechanics::NpcStats& stats = mActor.getClass().getNpcStats (mActor); std::map::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mFaction)); if (iter==stats.getFactionRanks().end()) @@ -98,7 +98,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const // check player faction if (!info.mPcFaction.empty()) { - MWMechanics::NpcStats& stats = MWWorld::Class::get (player).getNpcStats (player); + MWMechanics::NpcStats& stats = player.getClass().getNpcStats (player); std::map::iterator iter = stats.getFactionRanks().find (Misc::StringUtils::lowerCase (info.mPcFaction)); if(iter==stats.getFactionRanks().end()) @@ -182,7 +182,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c case SelectWrapper::Function_Local: { - std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor); + std::string scriptName = mActor.getClass().getScript (mActor); if (scriptName.empty()) return false; // no script @@ -220,8 +220,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() / - MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified(); + float ratio = player.getClass().getCreatureStats (player).getHealth().getCurrent() / + player.getClass().getCreatureStats (player).getHealth().getModified(); return select.selectCompare (static_cast(ratio*100)); } @@ -230,7 +230,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - float value = MWWorld::Class::get (player).getCreatureStats (player). + float value = player.getClass().getCreatureStats (player). getDynamic (select.getArgument()).getCurrent(); return select.selectCompare (value); @@ -238,8 +238,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c case SelectWrapper::Function_HealthPercent: { - float ratio = MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getCurrent() / - MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getModified(); + float ratio = mActor.getClass().getCreatureStats (mActor).getHealth().getCurrent() / + mActor.getClass().getCreatureStats (mActor).getHealth().getModified(); return select.selectCompare (ratio); } @@ -262,7 +262,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_Item: { - MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore (player); int sum = 0; @@ -285,29 +285,29 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_AiSetting: - return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting ( + return mActor.getClass().getCreatureStats (mActor).getAiSetting ( (MWMechanics::CreatureStats::AiSetting)select.getArgument()).getModified(); case SelectWrapper::Function_PcAttribute: - return MWWorld::Class::get (player).getCreatureStats (player). + return player.getClass().getCreatureStats (player). getAttribute (select.getArgument()).getModified(); case SelectWrapper::Function_PcSkill: - return static_cast (MWWorld::Class::get (player). + return static_cast (player.getClass(). getNpcStats (player).getSkill (select.getArgument()).getModified()); case SelectWrapper::Function_FriendlyHit: { - int hits = MWWorld::Class::get (mActor).getCreatureStats (mActor).getFriendlyHits(); + int hits = mActor.getClass().getCreatureStats (mActor).getFriendlyHits(); return hits>4 ? 4 : hits; } case SelectWrapper::Function_PcLevel: - return MWWorld::Class::get (player).getCreatureStats (player).getLevel(); + return player.getClass().getCreatureStats (player).getLevel(); case SelectWrapper::Function_PcGender: @@ -315,7 +315,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_PcClothingModifier: { - MWWorld::InventoryStore& store = MWWorld::Class::get (player).getInventoryStore (player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore (player); int value = 0; @@ -324,7 +324,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con MWWorld::ContainerStoreIterator slot = store.getSlot (i); if (slot!=store.end()) - value += MWWorld::Class::get (*slot).getValue (*slot); + value += slot->getClass().getValue (*slot); } return value; @@ -332,15 +332,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_PcCrimeLevel: - return MWWorld::Class::get (player).getNpcStats (player).getBounty(); + return player.getClass().getNpcStats (player).getBounty(); case SelectWrapper::Function_RankRequirement: { - if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty()) + if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty()) return 0; std::string faction = - MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first; + mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first; int rank = getFactionRank (player, faction); @@ -360,11 +360,11 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_Level: - return MWWorld::Class::get (mActor).getCreatureStats (mActor).getLevel(); + return mActor.getClass().getCreatureStats (mActor).getLevel(); case SelectWrapper::Function_PCReputation: - return MWWorld::Class::get (player).getNpcStats (player).getReputation(); + return player.getClass().getNpcStats (player).getReputation(); case SelectWrapper::Function_Weather: @@ -372,15 +372,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_Reputation: - return MWWorld::Class::get (mActor).getNpcStats (mActor).getReputation(); + return mActor.getClass().getNpcStats (mActor).getReputation(); case SelectWrapper::Function_FactionRankDiff: { - if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty()) + if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty()) return 0; std::pair faction = - *MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin(); + *mActor.getClass().getNpcStats (mActor).getFactionRanks().begin(); int rank = getFactionRank (player, faction.first); @@ -389,25 +389,25 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_WerewolfKills: - return MWWorld::Class::get (player).getNpcStats (player).getWerewolfKills(); + return player.getClass().getNpcStats (player).getWerewolfKills(); case SelectWrapper::Function_RankLow: case SelectWrapper::Function_RankHigh: { bool low = select.getFunction()==SelectWrapper::Function_RankLow; - if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty()) + if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty()) return 0; std::string factionId = - MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first; + mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first; int value = 0; const ESM::Faction& faction = *MWBase::Environment::get().getWorld()->getStore().get().find (factionId); - MWMechanics::NpcStats& playerStats = MWWorld::Class::get (player).getNpcStats (player); + MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats (player); for (std::vector::const_iterator iter (faction.mReactions.begin()); iter!=faction.mReactions.end(); ++iter) @@ -436,7 +436,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_NotId: - return !Misc::StringUtils::ciEqual(MWWorld::Class::get (mActor).getId (mActor), select.getName()); + return !Misc::StringUtils::ciEqual(mActor.getClass().getId (mActor), select.getName()); case SelectWrapper::Function_NotFaction: @@ -456,7 +456,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_NotLocal: { - std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor); + std::string scriptName = mActor.getClass().getScript (mActor); if (scriptName.empty()) // This actor has no attached script, so there is no local variable @@ -489,36 +489,36 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_SameFaction: - return MWWorld::Class::get (mActor).getNpcStats (mActor).isSameFaction ( - MWWorld::Class::get (player).getNpcStats (player)); + return mActor.getClass().getNpcStats (mActor).isSameFaction ( + player.getClass().getNpcStats (player)); case SelectWrapper::Function_PcCommonDisease: - return MWWorld::Class::get (player).getCreatureStats (player).hasCommonDisease(); + return player.getClass().getCreatureStats (player).hasCommonDisease(); case SelectWrapper::Function_PcBlightDisease: - return MWWorld::Class::get (player).getCreatureStats (player).hasBlightDisease(); + return player.getClass().getCreatureStats (player).hasBlightDisease(); case SelectWrapper::Function_PcCorprus: - return MWWorld::Class::get (player).getCreatureStats (player). + return player.getClass().getCreatureStats (player). getMagicEffects().get (ESM::MagicEffect::Corprus).mMagnitude!=0; case SelectWrapper::Function_PcExpelled: { - if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty()) + if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty()) return false; std::string faction = - MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first; + mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first; return player.getClass().getNpcStats(player).getExpelled(faction); } case SelectWrapper::Function_PcVampire: - return MWWorld::Class::get (player).getCreatureStats(player).getMagicEffects(). + return player.getClass().getCreatureStats(player).getMagicEffects(). get(ESM::MagicEffect::Vampirism).mMagnitude > 0; case SelectWrapper::Function_TalkedToPc: @@ -527,7 +527,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_Alarmed: - return MWWorld::Class::get (mActor).getCreatureStats (mActor).isAlarmed(); + return mActor.getClass().getCreatureStats (mActor).isAlarmed(); case SelectWrapper::Function_Detected: @@ -535,11 +535,11 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_Attacked: - return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAttacked(); + return mActor.getClass().getCreatureStats (mActor).getAttacked(); case SelectWrapper::Function_ShouldAttack: - return MWWorld::Class::get (mActor).getCreatureStats (mActor).isHostile(); + return mActor.getClass().getCreatureStats (mActor).isHostile(); case SelectWrapper::Function_CreatureTargetted: @@ -547,7 +547,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co case SelectWrapper::Function_Werewolf: - return MWWorld::Class::get (mActor).getNpcStats (mActor).isWerewolf(); + return mActor.getClass().getNpcStats (mActor).isWerewolf(); default: @@ -557,7 +557,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co int MWDialogue::Filter::getFactionRank (const MWWorld::Ptr& actor, const std::string& factionId) const { - MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor); + MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor); std::map::const_iterator iter = stats.getFactionRanks().find (factionId); @@ -573,13 +573,13 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements (const MWWorld::Ptr& ac if (rank<0 || rank>=10) throw std::runtime_error ("rank index out of range"); - if (!MWWorld::Class::get (actor).getNpcStats (actor).hasSkillsForRank (factionId, rank)) + if (!actor.getClass().getNpcStats (actor).hasSkillsForRank (factionId, rank)) return false; const ESM::Faction& faction = *MWBase::Environment::get().getWorld()->getStore().get().find (factionId); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (actor).getCreatureStats (actor); + MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats (actor); return stats.getAttribute (faction.mData.mAttribute[0]).getBase()>=faction.mData.mRankData[rank].mAttribute1 && stats.getAttribute (faction.mData.mAttribute[1]).getBase()>=faction.mData.mRankData[rank].mAttribute2; @@ -591,7 +591,7 @@ bool MWDialogue::Filter::hasFactionRankReputationRequirements (const MWWorld::Pt if (rank<0 || rank>=10) throw std::runtime_error ("rank index out of range"); - MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor); + MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor); const ESM::Faction& faction = *MWBase::Environment::get().getWorld()->getStore().get().find (factionId); diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index a6880ffcb..6524c168e 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -19,7 +19,7 @@ namespace std::string getIconPath(MWWorld::Ptr ptr) { std::string path = std::string("icons\\"); - path += MWWorld::Class::get(ptr).getInventoryIcon(ptr); + path += ptr.getClass().getInventoryIcon(ptr); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -174,7 +174,7 @@ namespace MWGui { update(); - std::string sound = MWWorld::Class::get(item).getUpSoundId(item); + std::string sound = item.getClass().getUpSoundId(item); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); } } diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index fa1bd28be..85f57a1a8 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -47,7 +47,7 @@ namespace void updatePlayerHealth() { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player); + MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player); npcStats.updateHealth(); } } @@ -220,7 +220,7 @@ namespace MWGui { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); mReviewDialog->setHealth ( stats.getHealth() ); mReviewDialog->setMagicka( stats.getMagicka() ); diff --git a/apps/openmw/mwgui/companionwindow.cpp b/apps/openmw/mwgui/companionwindow.cpp index a0a34108e..70093049d 100644 --- a/apps/openmw/mwgui/companionwindow.cpp +++ b/apps/openmw/mwgui/companionwindow.cpp @@ -61,7 +61,7 @@ void CompanionWindow::onItemSelected(int index) if (count > 1 && !shift) { CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog(); - dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count); + dialog->open(object.getClass().getName(object), "#{sTake}", count); dialog->eventOkClicked.clear(); dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::dragItem); } @@ -92,7 +92,7 @@ void CompanionWindow::open(const MWWorld::Ptr& npc) mSortModel = new SortFilterItemModel(mModel); mItemView->setModel(mSortModel); - setTitle(MWWorld::Class::get(npc).getName(npc)); + setTitle(npc.getClass().getName(npc)); } void CompanionWindow::onFrame() @@ -104,22 +104,22 @@ void CompanionWindow::updateEncumbranceBar() { if (mPtr.isEmpty()) return; - float capacity = MWWorld::Class::get(mPtr).getCapacity(mPtr); - float encumbrance = MWWorld::Class::get(mPtr).getEncumbrance(mPtr); + float capacity = mPtr.getClass().getCapacity(mPtr); + float encumbrance = mPtr.getClass().getEncumbrance(mPtr); mEncumbranceBar->setValue(encumbrance, capacity); if (mPtr.getTypeName() != typeid(ESM::NPC).name()) mProfitLabel->setCaption(""); else { - MWMechanics::NpcStats& stats = MWWorld::Class::get(mPtr).getNpcStats(mPtr); + MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr); mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + boost::lexical_cast(stats.getProfit())); } } void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender) { - if (mPtr.getTypeName() == typeid(ESM::NPC).name() && MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit() < 0) + if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0) { std::vector buttons; buttons.push_back("#{sCompanionWarningButtonOne}"); @@ -135,8 +135,8 @@ void CompanionWindow::onMessageBoxButtonClicked(int button) { if (button == 0) { - mPtr.getRefData().getLocals().setVarByInt(MWWorld::Class::get(mPtr).getScript(mPtr), - "minimumProfit", MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit()); + mPtr.getRefData().getLocals().setVarByInt(mPtr.getClass().getScript(mPtr), + "minimumProfit", mPtr.getClass().getNpcStats(mPtr).getProfit()); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion); MWBase::Environment::get().getDialogueManager()->startDialogue (mPtr); diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 02c4b9356..a207dec0c 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -37,7 +37,7 @@ namespace MWGui mIsOnDragAndDrop = true; mDragAndDropWidget->setVisible(true); - std::string sound = MWWorld::Class::get(mItem.mBase).getUpSoundId(mItem.mBase); + std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); if (mSourceSortModel) @@ -47,7 +47,7 @@ namespace MWGui } std::string path = std::string("icons\\"); - path += MWWorld::Class::get(mItem.mBase).getInventoryIcon(mItem.mBase); + path += mItem.mBase.getClass().getInventoryIcon(mItem.mBase); MyGUI::ImageBox* baseWidget = mDragAndDropWidget->createWidget ("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default); mDraggedWidget = baseWidget; @@ -76,7 +76,7 @@ namespace MWGui void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView) { - std::string sound = MWWorld::Class::get(mItem.mBase).getDownSoundId(mItem.mBase); + std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); mDragAndDropWidget->setVisible(false); @@ -155,7 +155,7 @@ namespace MWGui if (count > 1 && !shift) { CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog(); - dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count); + dialog->open(object.getClass().getName(object), "#{sTake}", count); dialog->eventOkClicked.clear(); dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::dragItem); } @@ -177,8 +177,8 @@ namespace MWGui { // check that we don't exceed container capacity MWWorld::Ptr item = mDragAndDrop->mItem.mBase; - float weight = MWWorld::Class::get(item).getWeight(item) * mDragAndDrop->mDraggedCount; - if (MWWorld::Class::get(mPtr).getCapacity(mPtr) < MWWorld::Class::get(mPtr).getEncumbrance(mPtr) + weight) + float weight = item.getClass().getWeight(item) * mDragAndDrop->mDraggedCount; + if (mPtr.getClass().getCapacity(mPtr) < mPtr.getClass().getEncumbrance(mPtr) + weight) { MWBase::Environment::get().getWindowManager()->messageBox("#{sContentsMessage3}"); return; @@ -227,7 +227,7 @@ namespace MWGui // Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last // or we end up using a possibly invalid model. - setTitle(MWWorld::Class::get(container).getName(container)); + setTitle(container.getClass().getName(container)); } void ContainerWindow::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char) @@ -284,7 +284,7 @@ namespace MWGui { // play the sound of the first object MWWorld::Ptr item = mModel->getItem(i).mBase; - std::string sound = MWWorld::Class::get(item).getUpSoundId(item); + std::string sound = item.getClass().getUpSoundId(item); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); } @@ -306,7 +306,7 @@ namespace MWGui { onTakeAllButtonClicked(mTakeButton); - if (MWWorld::Class::get(mPtr).isPersistent(mPtr)) + if (mPtr.getClass().isPersistent(mPtr)) MWBase::Environment::get().getWindowManager()->messageBox("#{sDisposeCorpseFail}"); else MWBase::Environment::get().getWorld()->deleteObject(mPtr); diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index b5b498e5e..b2befc3ba 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -85,7 +85,7 @@ void ContainerItemModel::removeItem (const ItemStack& item, size_t count) for (std::vector::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source) { - MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source); + MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source); for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) { @@ -120,7 +120,7 @@ void ContainerItemModel::update() mItems.clear(); for (std::vector::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source) { - MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source); + MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source); for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it) { diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index dcd26d469..000275794 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -386,8 +386,8 @@ namespace MWGui mTopicLinks.clear(); mKeywordSearch.clear(); - bool isCompanion = !MWWorld::Class::get(mPtr).getScript(mPtr).empty() - && mPtr.getRefData().getLocals().getIntVar(MWWorld::Class::get(mPtr).getScript(mPtr), "companion"); + bool isCompanion = !mPtr.getClass().getScript(mPtr).empty() + && mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion"); bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name(); diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index ada004612..b303848df 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -119,7 +119,7 @@ namespace MWGui MyGUI::ImageBox* image = mSoulBox->createWidget("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(soulgem).getInventoryIcon(soulgem); + path += soulgem.getClass().getInventoryIcon(soulgem); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -164,7 +164,7 @@ namespace MWGui MyGUI::ImageBox* image = mItemBox->createWidget("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -207,7 +207,7 @@ namespace MWGui MyGUI::ImageBox* image = mSoulBox->createWidget("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 079793ee1..103c48ca1 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -348,7 +348,7 @@ namespace MWGui void HUD::onWeaponClicked(MyGUI::Widget* _sender) { const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) + if (player.getClass().getNpcStats(player).isWerewolf()) { MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); return; @@ -360,7 +360,7 @@ namespace MWGui void HUD::onMagicClicked(MyGUI::Widget* _sender) { const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) + if (player.getClass().getNpcStats(player).isWerewolf()) { MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}"); return; @@ -443,7 +443,7 @@ namespace MWGui void HUD::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) { - std::string itemName = MWWorld::Class::get(item).getName(item); + std::string itemName = item.getClass().getName(item); if (itemName != mSpellName && mSpellVisible) { mWeaponSpellTimer = 5.0f; @@ -466,7 +466,7 @@ namespace MWGui , MyGUI::Align::Stretch); std::string path = std::string("icons\\"); - path+=MWWorld::Class::get(item).getInventoryIcon(item); + path+=item.getClass().getInventoryIcon(item); Widgets::fixTexturePath(path); itemBox->setImageTexture(path); itemBox->setNeedMouseFocus(false); @@ -474,7 +474,7 @@ namespace MWGui void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) { - std::string itemName = MWWorld::Class::get(item).getName(item); + std::string itemName = item.getClass().getName(item); if (itemName != mWeaponName && mWeaponVisible) { mWeaponSpellTimer = 5.0f; @@ -493,10 +493,10 @@ namespace MWGui MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0)); std::string path = std::string("icons\\"); - path+=MWWorld::Class::get(item).getInventoryIcon(item); + path+=item.getClass().getInventoryIcon(item); Widgets::fixTexturePath(path); - if (MWWorld::Class::get(item).getEnchantment(item) != "") + if (item.getClass().getEnchantment(item) != "") { mWeapImage->setImageTexture("textures\\menu_icon_magic_mini.dds"); MyGUI::ImageBox* itemBox = mWeapImage->createWidgetReal("ImageBox", MyGUI::FloatCoord(0,0,1,1) @@ -545,7 +545,7 @@ namespace MWGui MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) + if (player.getClass().getNpcStats(player).isWerewolf()) mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds"); else mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds"); @@ -636,7 +636,7 @@ namespace MWGui void HUD::updateEnemyHealthBar() { - MWMechanics::CreatureStats& stats = MWWorld::Class::get(mEnemy).getCreatureStats(mEnemy); + MWMechanics::CreatureStats& stats = mEnemy.getClass().getCreatureStats(mEnemy); mEnemyHealth->setProgressRange(100); // Health is usually cast to int before displaying. Actors die whenever they are < 1 health. // Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :) diff --git a/apps/openmw/mwgui/inventoryitemmodel.cpp b/apps/openmw/mwgui/inventoryitemmodel.cpp index 718c6d991..e1bc9d4da 100644 --- a/apps/openmw/mwgui/inventoryitemmodel.cpp +++ b/apps/openmw/mwgui/inventoryitemmodel.cpp @@ -50,7 +50,7 @@ MWWorld::Ptr InventoryItemModel::copyItem (const ItemStack& item, size_t count, void InventoryItemModel::removeItem (const ItemStack& item, size_t count) { - MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor); + MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor); int removed = store.remove(item.mBase, count, mActor); if (removed == 0) @@ -77,7 +77,7 @@ MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, I void InventoryItemModel::update() { - MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor); + MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor); mItems.clear(); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index e9a4a18e5..788f90f50 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -162,7 +162,7 @@ namespace MWGui } const ItemStack& item = mTradeModel->getItem(index); - std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase); + std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); MWWorld::Ptr object = item.mBase; int count = item.mCount; @@ -184,7 +184,7 @@ namespace MWGui { // check if merchant accepts item int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices(); - if (!MWWorld::Class::get(object).canSell(object, services)) + if (!object.getClass().canSell(object, services)) { MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()-> @@ -197,7 +197,7 @@ namespace MWGui { CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog(); std::string message = mTrading ? "#{sQuanityMenuMessage01}" : "#{sTake}"; - dialog->open(MWWorld::Class::get(object).getName(object), message, count); + dialog->open(object.getClass().getName(object), message, count); dialog->eventOkClicked.clear(); if (mTrading) dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem); @@ -223,7 +223,7 @@ namespace MWGui const ItemStack& item = mTradeModel->getItem(mSelectedItem); if (item.mType == ItemStack::Type_Equipped) { - MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr); + MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr); MWWorld::Ptr newStack = *invStore.unequipItem(item.mBase, mPtr); // The unequipped item was re-stacked. We have to update the index @@ -259,7 +259,7 @@ namespace MWGui { ensureSelectedItemUnequipped(); const ItemStack& item = mTradeModel->getItem(mSelectedItem); - std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase); + std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); if (item.mType == ItemStack::Type_Barter) @@ -382,7 +382,7 @@ namespace MWGui if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0) { - boost::shared_ptr action = MWWorld::Class::get(ptr).use(ptr); + boost::shared_ptr action = ptr.getClass().use(ptr); action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr()); @@ -447,7 +447,7 @@ namespace MWGui if (slot == -1) return MWWorld::Ptr(); - MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr); + MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr); if(invStore.getSlot(slot) != invStore.end()) { MWWorld::Ptr item = *invStore.getSlot(slot); @@ -466,8 +466,8 @@ namespace MWGui { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - float capacity = MWWorld::Class::get(player).getCapacity(player); - float encumbrance = MWWorld::Class::get(player).getEncumbrance(player); + float capacity = player.getClass().getCapacity(player); + float encumbrance = player.getClass().getEncumbrance(player); mEncumbranceBar->setValue(encumbrance, capacity); } @@ -498,9 +498,9 @@ namespace MWGui mAvatarImage->setImageTile(MyGUI::IntSize(std::min(512, size.width), std::min(1024, size.height))); mArmorRating->setCaptionWithReplacing ("#{sArmor}: " - + boost::lexical_cast(static_cast(MWWorld::Class::get(mPtr).getArmorRating(mPtr)))); + + boost::lexical_cast(static_cast(mPtr.getClass().getArmorRating(mPtr)))); if (mArmorRating->getTextSize().width > mArmorRating->getSize().width) - mArmorRating->setCaptionWithReplacing (boost::lexical_cast(static_cast(MWWorld::Class::get(mPtr).getArmorRating(mPtr)))); + mArmorRating->setCaptionWithReplacing (boost::lexical_cast(static_cast(mPtr.getClass().getArmorRating(mPtr)))); } } @@ -534,7 +534,7 @@ namespace MWGui && (type != typeid(ESM::Potion).name())) return; - if (MWWorld::Class::get(object).getName(object) == "") // objects without name presented to user can never be picked up + if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up return; int count = object.getRefData().getCount(); diff --git a/apps/openmw/mwgui/itemmodel.cpp b/apps/openmw/mwgui/itemmodel.cpp index 2cdd8a2e6..55317724e 100644 --- a/apps/openmw/mwgui/itemmodel.cpp +++ b/apps/openmw/mwgui/itemmodel.cpp @@ -13,7 +13,7 @@ namespace MWGui , mType(Type_Normal) , mBase(base) { - if (MWWorld::Class::get(base).getEnchantment(base) != "") + if (base.getClass().getEnchantment(base) != "") mFlags |= Flag_Enchanted; } diff --git a/apps/openmw/mwgui/itemview.cpp b/apps/openmw/mwgui/itemview.cpp index 027c3201f..24bc3fd63 100644 --- a/apps/openmw/mwgui/itemview.cpp +++ b/apps/openmw/mwgui/itemview.cpp @@ -81,7 +81,7 @@ void ItemView::update() /// \todo performance improvement: don't create/destroy all the widgets everytime the container window changes size, only reposition them std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item.mBase).getInventoryIcon(item.mBase); + path += item.mBase.getClass().getInventoryIcon(item.mBase); // background widget (for the "equipped" frame and magic item background image) bool isMagic = (item.mFlags & ItemStack::Flag_Enchanted); diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index 5a3fc2855..38995ac32 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -61,8 +61,8 @@ namespace MWGui void LevelupDialog::setAttributeValues() { MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); - MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player); + MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player); for (int i=0; i<8; ++i) { @@ -117,8 +117,8 @@ namespace MWGui { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player); - MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player); + MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player); mSpentAttributes.clear(); resetCoins(); @@ -172,7 +172,7 @@ namespace MWGui void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender) { MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player); if (mSpentAttributes.size() < 3) MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}"); diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp index 2a48e62a9..83527a884 100644 --- a/apps/openmw/mwgui/merchantrepair.cpp +++ b/apps/openmw/mwgui/merchantrepair.cpp @@ -39,19 +39,19 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); iter!=store.end(); ++iter) { - if (MWWorld::Class::get(*iter).hasItemHealth(*iter)) + if (iter->getClass().hasItemHealth(*iter)) { - int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter); + int maxDurability = iter->getClass().getItemMaxHealth(*iter); int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge; if (maxDurability == durability) continue; - int basePrice = MWWorld::Class::get(*iter).getValue(*iter); + int basePrice = iter->getClass().getValue(*iter); float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get() .find("fRepairMult")->getFloat(); @@ -64,7 +64,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true); - std::string name = MWWorld::Class::get(*iter).getName(*iter) + std::string name = iter->getClass().getName(*iter) + " - " + boost::lexical_cast(price) + MWBase::Environment::get().getWorld()->getStore().get() .find("sgp")->getString();; @@ -114,7 +114,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender) { // repair MWWorld::Ptr item = *sender->getUserData(); - item.getCellRef().mCharge = MWWorld::Class::get(item).getItemMaxHealth(item); + item.getCellRef().mCharge = item.getClass().getItemMaxHealth(item); MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 51e24e29c..5df2b12b8 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -166,7 +166,7 @@ namespace MWGui frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked); MyGUI::ImageBox* image = frame->createWidget("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -200,7 +200,7 @@ namespace MWGui MyGUI::ImageBox* image = frame->createWidget("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -265,7 +265,7 @@ namespace MWGui QuickKeyType type = *button->getUserData(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); if (type == Type_Item || type == Type_MagicItem) { @@ -290,7 +290,7 @@ namespace MWGui { // No replacement was found MWBase::Environment::get().getWindowManager ()->messageBox ( - "#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item)); + "#{sQuickMenu5} " + item.getClass().getName(item)); return; } } @@ -330,7 +330,7 @@ namespace MWGui assert(it != store.end()); // equip, if it can be equipped - if (!MWWorld::Class::get(item).getEquipmentSlots(item).first.empty()) + if (!item.getClass().getEquipmentSlots(item).first.empty()) { MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item); } @@ -522,8 +522,8 @@ namespace MWGui const int spellHeight = 18; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); /// \todo lots of copy&pasted code from SpellWindow @@ -566,7 +566,7 @@ namespace MWGui std::vector items; for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it) { - std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it); + std::string enchantId = it->getClass().getEnchantment(*it); if (enchantId != "") { // only add items with "Cast once" or "Cast on use" @@ -645,7 +645,7 @@ namespace MWGui MyGUI::Button* t = mMagicList->createWidget(equipped ? "SpellText" : "SpellTextUnequipped", MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top); - t->setCaption(MWWorld::Class::get(item).getName(item)); + t->setCaption(item.getClass().getName(item)); t->setTextAlign(MyGUI::Align::Left); t->setUserData(item); t->setUserString("ToolTipType", "ItemPtr"); diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp index 683406d9e..313650bb6 100644 --- a/apps/openmw/mwgui/recharge.cpp +++ b/apps/openmw/mwgui/recharge.cpp @@ -41,7 +41,7 @@ void Recharge::open() void Recharge::start (const MWWorld::Ptr &item) { std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -85,7 +85,7 @@ void Recharge::updateView() int currentY = 0; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter) { @@ -99,14 +99,14 @@ void Recharge::updateView() MyGUI::TextBox* text = mView->createWidget ( "SandText", MyGUI::IntCoord(8, currentY, mView->getWidth()-8, 18), MyGUI::Align::Default); - text->setCaption(MWWorld::Class::get(*iter).getName(*iter)); + text->setCaption(iter->getClass().getName(*iter)); text->setNeedMouseFocus(false); currentY += 19; MyGUI::ImageBox* icon = mView->createWidget ( "ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(*iter).getInventoryIcon(*iter); + path += iter->getClass().getInventoryIcon(*iter); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); diff --git a/apps/openmw/mwgui/repair.cpp b/apps/openmw/mwgui/repair.cpp index de96bcacd..a3df2dfbe 100644 --- a/apps/openmw/mwgui/repair.cpp +++ b/apps/openmw/mwgui/repair.cpp @@ -40,7 +40,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item) mRepair.setTool(item); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(item).getInventoryIcon(item); + path += item.getClass().getInventoryIcon(item); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); @@ -90,28 +90,28 @@ void Repair::updateRepairView() int currentY = 0; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor; for (MWWorld::ContainerStoreIterator iter (store.begin(categories)); iter!=store.end(); ++iter) { - if (MWWorld::Class::get(*iter).hasItemHealth(*iter)) + if (iter->getClass().hasItemHealth(*iter)) { - int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter); + int maxDurability = iter->getClass().getItemMaxHealth(*iter); int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge; if (maxDurability == durability) continue; MyGUI::TextBox* text = mRepairView->createWidget ( "SandText", MyGUI::IntCoord(8, currentY, mRepairView->getWidth()-8, 18), MyGUI::Align::Default); - text->setCaption(MWWorld::Class::get(*iter).getName(*iter)); + text->setCaption(iter->getClass().getName(*iter)); text->setNeedMouseFocus(false); currentY += 19; MyGUI::ImageBox* icon = mRepairView->createWidget ( "ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); std::string path = std::string("icons\\"); - path += MWWorld::Class::get(*iter).getInventoryIcon(*iter); + path += iter->getClass().getInventoryIcon(*iter); int pos = path.rfind("."); path.erase(pos); path.append(".dds"); diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index 74a4f88e7..475f73a07 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -47,8 +47,8 @@ namespace if (left.mBase.getTypeName() == right.mBase.getTypeName()) { - int cmp = MWWorld::Class::get(left.mBase).getName(left.mBase).compare( - MWWorld::Class::get(right.mBase).getName(right.mBase)); + int cmp = left.mBase.getClass().getName(left.mBase).compare( + right.mBase.getClass().getName(right.mBase)); return cmp < 0; } else diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 77df46514..99b85c13c 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -83,7 +83,7 @@ namespace MWGui mPtr = actor; clearSpells(); - MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells(); + MWMechanics::Spells& merchantSpells = actor.getClass().getCreatureStats (actor).getSpells(); for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter) { @@ -107,7 +107,7 @@ namespace MWGui bool SpellBuyingWindow::playerHasSpell(const std::string &id) { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells(); + MWMechanics::Spells& playerSpells = player.getClass().getCreatureStats (player).getSpells(); for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it) { if (Misc::StringUtils::ciEqual(id, it->first)) @@ -121,7 +121,7 @@ namespace MWGui int price = *_sender->getUserData(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); spells.add (mSpellsWidgetMap.find(_sender)->second); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 469d7188e..1ec4bd6da 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -353,7 +353,7 @@ namespace MWGui const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); spells.add (spell->mId); @@ -445,7 +445,7 @@ namespace MWGui // get the list of magic effects that are known to the player MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); std::vector knownEffects; diff --git a/apps/openmw/mwgui/spellicons.cpp b/apps/openmw/mwgui/spellicons.cpp index d5ece298b..1a9e418de 100644 --- a/apps/openmw/mwgui/spellicons.cpp +++ b/apps/openmw/mwgui/spellicons.cpp @@ -40,14 +40,14 @@ namespace MWGui // TODO: Tracking add/remove/expire would be better than force updating every frame MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); EffectSourceVisitor visitor; // permanent item enchantments & permanent spells visitor.mIsPermanent = true; - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); store.visitEffectSources(visitor); stats.getSpells().visitEffectSources(visitor); diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index a00c2480e..16e474143 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -84,8 +84,8 @@ namespace MWGui // retrieve all player spells, divide them into Powers and Spells and sort them std::vector spellList; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it) @@ -122,7 +122,7 @@ namespace MWGui std::vector items; for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it) { - std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it); + std::string enchantId = it->getClass().getEnchantment(*it); if (enchantId != "") { // only add items with "Cast once" or "Cast on use" @@ -203,7 +203,7 @@ namespace MWGui MWWorld::Ptr item = *it; const ESM::Enchantment* enchant = - esmStore.get().find(MWWorld::Class::get(item).getEnchantment(item)); + esmStore.get().find(item.getClass().getEnchantment(item)); // check if the item is currently equipped (will display in a different color) bool equipped = false; @@ -218,7 +218,7 @@ namespace MWGui MyGUI::Button* t = mSpellView->createWidget(equipped ? "SpellText" : "SpellTextUnequipped", MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top); - t->setCaption(MWWorld::Class::get(item).getName(item)); + t->setCaption(item.getClass().getName(item)); t->setTextAlign(MyGUI::Align::Left); t->setUserData(item); t->setUserString("ToolTipType", "ItemPtr"); @@ -300,7 +300,7 @@ namespace MWGui void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender) { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); MWWorld::Ptr item = *_sender->getUserData(); // retrieve ContainerStoreIterator to the item @@ -316,7 +316,7 @@ namespace MWGui // equip, if it can be equipped and is not already equipped if (_sender->getUserString("Equipped") == "false" - && !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty()) + && !item.getClass().getEquipmentSlots(item).first.empty()) { MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item); } @@ -330,7 +330,7 @@ namespace MWGui { std::string spellId = _sender->getUserString("Spell"); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player); + MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player); if (MyGUI::InputManager::getInstance().isShiftPressed()) { @@ -384,7 +384,7 @@ namespace MWGui void SpellWindow::onDeleteSpellAccept() { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); MWMechanics::Spells& spells = stats.getSpells(); if (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == mSpellToDelete) diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp index 31a3b6fdd..6ae44e314 100644 --- a/apps/openmw/mwgui/statswindow.cpp +++ b/apps/openmw/mwgui/statswindow.cpp @@ -228,7 +228,7 @@ namespace MWGui NoDrop::onFrame(dt); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); + const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player); // level progress MyGUI::Widget* levelWidget; @@ -459,7 +459,7 @@ namespace MWGui addSeparator(coord1, coord2); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player); + const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player); const std::set &expelled = PCstats.getExpelled(); addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sFaction", "Faction"), coord1, coord2); diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index b931966f0..dd29f40ce 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -89,7 +89,7 @@ namespace MWGui if (mFocusObject.isEmpty ()) return; - const MWWorld::Class& objectclass = MWWorld::Class::get (mFocusObject); + const MWWorld::Class& objectclass = mFocusObject.getClass(); MyGUI::IntSize tooltipSize; if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)) @@ -305,7 +305,7 @@ namespace MWGui MyGUI::IntSize tooltipSize; - const MWWorld::Class& object = MWWorld::Class::get (mFocusObject); + const MWWorld::Class& object = mFocusObject.getClass(); if (!object.hasToolTip(mFocusObject)) { mDynamicToolTipBox->setVisible(false); diff --git a/apps/openmw/mwgui/tradeitemmodel.cpp b/apps/openmw/mwgui/tradeitemmodel.cpp index ad18a13e8..18b0d5ae3 100644 --- a/apps/openmw/mwgui/tradeitemmodel.cpp +++ b/apps/openmw/mwgui/tradeitemmodel.cpp @@ -138,7 +138,7 @@ namespace MWGui int services = 0; if (!mMerchant.isEmpty()) - services = MWWorld::Class::get(mMerchant).getServices(mMerchant); + services = mMerchant.getClass().getServices(mMerchant); mItems.clear(); // add regular items @@ -150,7 +150,7 @@ namespace MWGui MWWorld::Ptr base = item.mBase; if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, MWWorld::ContainerStore::sGoldId)) continue; - if(!MWWorld::Class::get(base).canSell(base, services)) + if(!base.getClass().canSell(base, services)) continue; // Bound items may not be bought @@ -164,7 +164,7 @@ namespace MWGui if(mMerchant.getClass().hasInventoryStore(mMerchant)) { bool isEquipped = false; - MWWorld::InventoryStore& store = MWWorld::Class::get(mMerchant).getInventoryStore(mMerchant); + MWWorld::InventoryStore& store = mMerchant.getClass().getInventoryStore(mMerchant); for (int slot=0; slotgetCountDialog(); std::string message = "#{sQuanityMenuMessage02}"; - dialog->open(MWWorld::Class::get(object).getName(object), message, count); + dialog->open(object.getClass().getName(object), message, count); dialog->eventOkClicked.clear(); dialog->eventOkClicked += MyGUI::newDelegate(this, &TradeWindow::sellItem); mItemToSell = mSortModel->mapToSource(index); @@ -165,7 +165,7 @@ namespace MWGui void TradeWindow::sellItem(MyGUI::Widget* sender, int count) { const ItemStack& item = mTradeModel->getItem(mItemToSell); - std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase); + std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel(); @@ -208,7 +208,7 @@ namespace MWGui void TradeWindow::addOrRemoveGold(int amount, const MWWorld::Ptr& actor) { - MWWorld::ContainerStore& store = MWWorld::Class::get(actor).getContainerStore(actor); + MWWorld::ContainerStore& store = actor.getClass().getContainerStore(actor); if (amount > 0) { @@ -442,7 +442,7 @@ namespace MWGui void TradeWindow::sellToNpc(const MWWorld::Ptr& item, int count, bool boughtItem) { - int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, boughtItem); + int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, boughtItem); mCurrentBalance += diff; mCurrentMerchantOffer += diff; @@ -452,7 +452,7 @@ namespace MWGui void TradeWindow::buyFromNpc(const MWWorld::Ptr& item, int count, bool soldItem) { - int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, !soldItem); + int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, !soldItem); mCurrentBalance -= diff; mCurrentMerchantOffer -= diff; diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp index bee76992a..34873b9bc 100644 --- a/apps/openmw/mwgui/trainingwindow.cpp +++ b/apps/openmw/mwgui/trainingwindow.cpp @@ -44,7 +44,7 @@ namespace MWGui mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast(playerGold)); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor); + MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor); // NPC can train you in his best 3 skills std::vector< std::pair > bestSkills; @@ -73,7 +73,7 @@ namespace MWGui MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator (); MyGUI::Gui::getInstance ().destroyWidgets (widgets); - MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player); const MWWorld::Store &gmst = MWBase::Environment::get().getWorld()->getStore().get(); @@ -115,7 +115,7 @@ namespace MWGui int skillId = *sender->getUserData(); MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); @@ -123,7 +123,7 @@ namespace MWGui int price = pcStats.getSkill (skillId).getBase() * store.get().find("iTrainingMod")->getInt (); price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr); + MWMechanics::NpcStats& npcStats = mPtr.getClass().getNpcStats (mPtr); if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ()) { MWBase::Environment::get().getWindowManager()->messageBox ("#{sServiceTrainingWords}"); diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp index 89d73215d..642e1a644 100644 --- a/apps/openmw/mwgui/travelwindow.cpp +++ b/apps/openmw/mwgui/travelwindow.cpp @@ -161,7 +161,7 @@ namespace MWGui MWBase::Environment::get().getWorld()->changeToExteriorCell(pos); } - MWWorld::Class::get(player).adjustPosition(player); + player.getClass().adjustPosition(player); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue); MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(0); diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index ed1b9e0a9..6c07e14d3 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -171,11 +171,11 @@ namespace MWGui void WaitDialog::setCanRest (bool canRest) { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified()) && (stats.getHealth().getCurrent() >= stats.getHealth().getModified()) && (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified()); - MWMechanics::NpcStats& npcstats = MWWorld::Class::get(player).getNpcStats(player); + MWMechanics::NpcStats& npcstats = player.getClass().getNpcStats(player); bool werewolf = npcstats.isWerewolf(); mUntilHealedButton->setVisible(canRest && !full); @@ -231,7 +231,7 @@ namespace MWGui mWaiting = false; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player); + const MWMechanics::NpcStats &pcstats = player.getClass().getNpcStats(player); // trigger levelup if possible const MWWorld::Store &gmst = diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 81b28aa66..40fcc3530 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1027,20 +1027,20 @@ namespace MWGui { mSelectedSpell = ""; const ESM::Enchantment* ench = MWBase::Environment::get().getWorld()->getStore().get() - .find(MWWorld::Class::get(item).getEnchantment(item)); + .find(item.getClass().getEnchantment(item)); int chargePercent = (item.getCellRef().mEnchantmentCharge == -1) ? 100 : (item.getCellRef().mEnchantmentCharge / static_cast(ench->mData.mCharge) * 100); mHud->setSelectedEnchantItem(item, chargePercent); - mSpellWindow->setTitle(MWWorld::Class::get(item).getName(item)); + mSpellWindow->setTitle(item.getClass().getName(item)); } void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item) { int durabilityPercent = (item.getCellRef().mCharge == -1) ? 100 - : (item.getCellRef().mCharge / static_cast(MWWorld::Class::get(item).getItemMaxHealth(item)) * 100); + : (item.getCellRef().mCharge / static_cast(item.getClass().getItemMaxHealth(item)) * 100); mHud->setSelectedWeapon(item, durabilityPercent); - mInventoryWindow->setTitle(MWWorld::Class::get(item).getName(item)); + mInventoryWindow->setTitle(item.getClass().getName(item)); } void WindowManager::unsetSelectedSpell() diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 8095b0d05..cf71cc1aa 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -172,7 +172,7 @@ namespace MWInput if (action == A_Use) { - MWWorld::Class::get(mPlayer->getPlayer()).getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue); + mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue); } if (currentValue == 1) @@ -359,7 +359,7 @@ namespace MWInput { MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); mOverencumberedMessageDelay -= dt; - if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player)) + if (player.getClass().getEncumbrance(player) >= player.getClass().getCapacity(player)) { mPlayer->setAutoMove (false); if (mOverencumberedMessageDelay <= 0) @@ -664,7 +664,7 @@ namespace MWInput return; // Not allowed if no spell selected - MWWorld::InventoryStore& inventory = MWWorld::Class::get(mPlayer->getPlayer()).getInventoryStore(mPlayer->getPlayer()); + MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer()); if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() && inventory.getSelectedEnchantItem() == inventory.end()) return; diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 363647467..35667a23c 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -187,7 +187,7 @@ namespace MWMechanics void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer) { - CreatureStats& creatureStats = MWWorld::Class::get(actor1).getCreatureStats(actor1); + CreatureStats& creatureStats = actor1.getClass().getCreatureStats(actor1); if (againstPlayer && creatureStats.isHostile()) return; // already fighting against player @@ -244,13 +244,13 @@ namespace MWMechanics void Actors::adjustMagicEffects (const MWWorld::Ptr& creature) { - CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature); + CreatureStats& creatureStats = creature.getClass().getCreatureStats (creature); MagicEffects now = creatureStats.getSpells().getMagicEffects(); if (creature.getTypeName()==typeid (ESM::NPC).name()) { - MWWorld::InventoryStore& store = MWWorld::Class::get (creature).getInventoryStore (creature); + MWWorld::InventoryStore& store = creature.getClass().getInventoryStore (creature); now += store.getMagicEffects(); } @@ -265,7 +265,7 @@ namespace MWMechanics void Actors::calculateDynamicStats (const MWWorld::Ptr& ptr) { - CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr); + CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr); int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getBase(); int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getBase(); @@ -333,7 +333,7 @@ namespace MWMechanics void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration) { - CreatureStats &creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr); + CreatureStats &creatureStats = ptr.getClass().getCreatureStats(ptr); const MagicEffects &effects = creatureStats.getMagicEffects(); // attributes @@ -600,7 +600,7 @@ namespace MWMechanics void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr) { - NpcStats &npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr); + NpcStats &npcStats = ptr.getClass().getNpcStats(ptr); const MagicEffects &effects = npcStats.getMagicEffects(); // skills @@ -656,7 +656,7 @@ namespace MWMechanics { bool isPlayer = ptr.getRefData().getHandle()=="player"; - MWWorld::InventoryStore &inventoryStore = MWWorld::Class::get(ptr).getInventoryStore(ptr); + MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr); MWWorld::ContainerStoreIterator heldIter = inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); /** @@ -678,7 +678,7 @@ namespace MWMechanics { if (torch != inventoryStore.end()) { - if (!MWWorld::Class::get (ptr).getCreatureStats (ptr).isHostile()) + if (!ptr.getClass().getCreatureStats (ptr).isHostile()) { // For non-hostile NPCs, unequip whatever is in the left slot in favor of a light. if (heldIter != inventoryStore.end() && heldIter->getTypeName() != typeid(ESM::Light).name()) @@ -755,8 +755,8 @@ namespace MWMechanics if (ptr != player && ptr.getClass().isNpc()) { // get stats of witness - CreatureStats& creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr); - NpcStats& npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr); + CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr); + NpcStats& npcStats = ptr.getClass().getNpcStats(ptr); if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.isHostile()) { @@ -824,7 +824,7 @@ namespace MWMechanics void Actors::addActor (const MWWorld::Ptr& ptr, bool updateImmediately) { // erase previous death events since we are currently only tracking them while in an active cell - MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied(); + ptr.getClass().getCreatureStats(ptr).clearHasDied(); removeActor(ptr); @@ -964,7 +964,7 @@ namespace MWMechanics // Kill dead actors, update some variables for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter) { - const MWWorld::Class &cls = MWWorld::Class::get(iter->first); + const MWWorld::Class &cls = iter->first.getClass(); CreatureStats &stats = cls.getCreatureStats(iter->first); //KnockedOutOneFrameLogic @@ -1137,7 +1137,7 @@ namespace MWMechanics std::list list; for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++) { - const MWWorld::Class &cls = MWWorld::Class::get(iter->first); + const MWWorld::Class &cls = iter->first.getClass(); CreatureStats &stats = cls.getCreatureStats(iter->first); if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow) { @@ -1158,7 +1158,7 @@ namespace MWMechanics neighbors); //only care about those within the alarm disance for(std::vector::iterator iter(neighbors.begin());iter != neighbors.end();iter++) { - const MWWorld::Class &cls = MWWorld::Class::get(*iter); + const MWWorld::Class &cls = iter->getClass(); CreatureStats &stats = cls.getCreatureStats(*iter); if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat) { diff --git a/apps/openmw/mwmechanics/aiactivate.cpp b/apps/openmw/mwmechanics/aiactivate.cpp index 4b4b36ed6..3dfacb853 100644 --- a/apps/openmw/mwmechanics/aiactivate.cpp +++ b/apps/openmw/mwmechanics/aiactivate.cpp @@ -32,7 +32,7 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration) if(distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]) < 200) { //Stop when you get close actor.getClass().getMovementSettings(actor).mPosition[1] = 0; MWWorld::Ptr target = MWBase::Environment::get().getWorld()->getPtr(mObjectId,false); - MWWorld::Class::get(target).activate(target,actor).get()->execute(actor); //Arrest player + target.getClass().activate(target,actor).get()->execute(actor); //Arrest player return true; } else { diff --git a/apps/openmw/mwmechanics/aiavoiddoor.cpp b/apps/openmw/mwmechanics/aiavoiddoor.cpp index 44eacb0d1..504522582 100644 --- a/apps/openmw/mwmechanics/aiavoiddoor.cpp +++ b/apps/openmw/mwmechanics/aiavoiddoor.cpp @@ -63,7 +63,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(pos.pos[0],pos.pos[1],pos.pos[2]),100,actors); for(std::vector::iterator it = actors.begin(); it != actors.end(); it++) { if(*it != MWBase::Environment::get().getWorld()->getPlayerPtr()) { //Not the player - MWMechanics::AiSequence& seq = MWWorld::Class::get(*it).getCreatureStats(*it).getAiSequence(); + MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence(); if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once seq.stack(MWMechanics::AiAvoidDoor(mDoorPtr),*it); } diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index 0430adf06..07bb9726e 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -97,7 +97,7 @@ namespace MWMechanics { // Stop moving if the player is to far away MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, "idle3", 0, 1); - MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0; + actor.getClass().getMovementSettings(actor).mPosition[1] = 0; mMaxDist = 330; } diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 7120ff5af..1c870bda4 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -572,7 +572,7 @@ namespace MWMechanics void AiWander::stopWalking(const MWWorld::Ptr& actor) { mPathFinder.clearPath(); - MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0; + actor.getClass().getMovementSettings(actor).mPosition[1] = 0; } void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index af58e9ee0..64b358b96 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -292,13 +292,13 @@ void MWMechanics::Alchemy::addPotion (const std::string& name) void MWMechanics::Alchemy::increaseSkill() { - MWWorld::Class::get (mAlchemist).skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0); + mAlchemist.getClass().skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0); } float MWMechanics::Alchemy::getChance() const { - const CreatureStats& creatureStats = MWWorld::Class::get (mAlchemist).getCreatureStats (mAlchemist); - const NpcStats& npcStats = MWWorld::Class::get (mAlchemist).getNpcStats (mAlchemist); + const CreatureStats& creatureStats = mAlchemist.getClass().getCreatureStats (mAlchemist); + const NpcStats& npcStats = mAlchemist.getClass().getNpcStats (mAlchemist); return (npcStats.getSkill (ESM::Skill::Alchemy).getModified() + @@ -331,7 +331,7 @@ void MWMechanics::Alchemy::setAlchemist (const MWWorld::Ptr& npc) mEffects.clear(); - MWWorld::ContainerStore& store = MWWorld::Class::get (npc).getContainerStore (npc); + MWWorld::ContainerStore& store = npc.getClass().getContainerStore (npc); for (MWWorld::ContainerStoreIterator iter (store.begin (MWWorld::ContainerStore::Type_Apparatus)); iter!=store.end(); ++iter) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index b6d91db58..60bccb3f7 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -459,7 +459,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim if(!mAnimation) return; - const MWWorld::Class &cls = MWWorld::Class::get(mPtr); + const MWWorld::Class &cls = mPtr.getClass(); if(cls.isActor()) { /* Accumulate along X/Y only for now, until we can figure out how we should @@ -549,7 +549,7 @@ bool CharacterController::updateCreatureState() bool CharacterController::updateWeaponState() { - const MWWorld::Class &cls = MWWorld::Class::get(mPtr); + const MWWorld::Class &cls = mPtr.getClass(); CreatureStats &stats = cls.getCreatureStats(mPtr); WeaponType weaptype = WeapType_None; MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr); @@ -601,8 +601,8 @@ bool CharacterController::updateWeaponState() if(weapon != inv.end() && !(weaptype == WeapType_None && mWeaponType == WeapType_Spell)) { std::string soundid = (weaptype == WeapType_None) ? - MWWorld::Class::get(*weapon).getDownSoundId(*weapon) : - MWWorld::Class::get(*weapon).getUpSoundId(*weapon); + weapon->getClass().getDownSoundId(*weapon) : + weapon->getClass().getUpSoundId(*weapon); if(!soundid.empty()) { MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); @@ -983,7 +983,7 @@ bool CharacterController::updateWeaponState() void CharacterController::update(float duration) { MWBase::World *world = MWBase::Environment::get().getWorld(); - const MWWorld::Class &cls = MWWorld::Class::get(mPtr); + const MWWorld::Class &cls = mPtr.getClass(); Ogre::Vector3 movement(0.0f); updateVisibility(); diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index 87337cdd7..23246c294 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -52,7 +52,7 @@ namespace MWMechanics bool Enchanting::create() { const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); ESM::Enchantment enchantment; enchantment.mData.mCharge = getGemCharge(); @@ -67,7 +67,7 @@ namespace MWMechanics if(getEnchantChance() (RAND_MAX)*100) return false; - MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2); + mEnchanter.getClass().skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2); } if(mCastStyle==ESM::Enchantment::ConstantEffect) @@ -84,7 +84,7 @@ namespace MWMechanics // Apply the enchantment const ESM::Enchantment *enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord (enchantment); - MWWorld::Class::get(newItemPtr).applyEnchantment(newItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName); + newItemPtr.getClass().applyEnchantment(newItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName); // Add the new item to player inventory and remove the old one store.remove(mOldItemPtr, 1, player); @@ -212,7 +212,7 @@ namespace MWMechanics const float enchantCost = getEnchantPoints(); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player); + MWMechanics::NpcStats &stats = player.getClass().getNpcStats(player); int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified(); /* @@ -277,7 +277,7 @@ namespace MWMechanics float Enchanting::getEnchantChance() const { - const NpcStats& npcStats = MWWorld::Class::get (mEnchanter).getNpcStats (mEnchanter); + const NpcStats& npcStats = mEnchanter.getClass().getNpcStats (mEnchanter); float chance1 = (npcStats.getSkill (ESM::Skill::Enchant).getModified() + (0.25 * npcStats.getAttribute (ESM::Attribute::Intelligence).getModified()) @@ -295,7 +295,7 @@ namespace MWMechanics void Enchanting::payForEnchantment() const { const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player); } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index bf9a11d6e..5a72c8883 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -49,8 +49,8 @@ namespace MWMechanics { MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr); + MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr); + MWMechanics::NpcStats& npcStats = ptr.getClass().getNpcStats (ptr); const ESM::NPC *player = ptr.get()->mBase; @@ -215,7 +215,7 @@ namespace MWMechanics void MechanicsManager::add(const MWWorld::Ptr& ptr) { - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) mActors.addActor(ptr); else mObjects.addObject(ptr); @@ -234,7 +234,7 @@ namespace MWMechanics if(old == mWatched) mWatched = ptr; - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) mActors.updateActor(old, ptr); else mObjects.updateObject(old, ptr); @@ -475,13 +475,13 @@ namespace MWMechanics int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr) { - const MWMechanics::NpcStats& npcSkill = MWWorld::Class::get(ptr).getNpcStats(ptr); + const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr); float x = npcSkill.getBaseDisposition(); MWWorld::LiveCellRef* npc = ptr.get(); MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::LiveCellRef* player = playerPtr.get(); - const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); + const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr); if (Misc::StringUtils::ciEqual(npc->mBase->mRace, player->mBase->mRace)) x += MWBase::Environment::get().getWorld()->getStore().get().find("fDispRaceMod")->getFloat(); @@ -547,10 +547,10 @@ namespace MWMechanics if (ptr.getTypeName() == typeid(ESM::Creature).name()) return basePrice; - const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr); + const MWMechanics::NpcStats &sellerStats = ptr.getClass().getNpcStats(ptr); MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); + const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr); // I suppose the temporary disposition change _has_ to be considered here, // otherwise one would get different prices when exiting and re-entering the dialogue window... @@ -592,10 +592,10 @@ namespace MWMechanics const MWWorld::Store &gmst = MWBase::Environment::get().getWorld()->getStore().get(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc); + MWMechanics::NpcStats& npcStats = npc.getClass().getNpcStats(npc); MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); - const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr); + const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr); float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified() / gmst.find("fPersonalityMod")->getFloat(); @@ -741,27 +741,27 @@ namespace MWMechanics void MechanicsManager::forceStateUpdate(const MWWorld::Ptr &ptr) { - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) mActors.forceStateUpdate(ptr); } void MechanicsManager::playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number) { - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) mActors.playAnimationGroup(ptr, groupName, mode, number); else mObjects.playAnimationGroup(ptr, groupName, mode, number); } void MechanicsManager::skipAnimation(const MWWorld::Ptr& ptr) { - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) mActors.skipAnimation(ptr); else mObjects.skipAnimation(ptr); } bool MechanicsManager::checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string &groupName) { - if(MWWorld::Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) return mActors.checkAnimationPlaying(ptr, groupName); else return false; diff --git a/apps/openmw/mwmechanics/repair.cpp b/apps/openmw/mwmechanics/repair.cpp index 48179d344..dc8b567a9 100644 --- a/apps/openmw/mwmechanics/repair.cpp +++ b/apps/openmw/mwmechanics/repair.cpp @@ -31,8 +31,8 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) int uses = (mTool.getCellRef().mCharge != -1) ? mTool.getCellRef().mCharge : ref->mBase->mData.mUses; mTool.getCellRef().mCharge = uses-1; - MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player); + MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); + MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player); float fatigueTerm = stats.getFatigueTerm(); int pcStrength = stats.getAttribute(ESM::Attribute::Strength).getModified(); @@ -55,15 +55,15 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) // repair by 'y' points itemToRepair.getCellRef().mCharge += y; itemToRepair.getCellRef().mCharge = std::min(itemToRepair.getCellRef().mCharge, - MWWorld::Class::get(itemToRepair).getItemMaxHealth(itemToRepair)); + itemToRepair.getClass().getItemMaxHealth(itemToRepair)); // set the OnPCRepair variable on the item's script - std::string script = MWWorld::Class::get(itemToRepair).getScript(itemToRepair); + std::string script = itemToRepair.getClass().getScript(itemToRepair); if(script != "") itemToRepair.getRefData().getLocals().setVarByInt(script, "onpcrepair", 1); // increase skill - MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Armorer, 0); + player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0); MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}"); @@ -78,14 +78,14 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) if (mTool.getCellRef().mCharge == 0) { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); + MWWorld::ContainerStore& store = player.getClass().getContainerStore(player); store.remove(mTool, 1, player); std::string message = MWBase::Environment::get().getWorld()->getStore().get() .find("sNotifyMessage51")->getString(); - MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % MWWorld::Class::get(mTool).getName(mTool)).str()); + MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % mTool.getClass().getName(mTool)).str()); // try to find a new tool of the same ID for (MWWorld::ContainerStoreIterator iter (store.begin()); diff --git a/apps/openmw/mwmechanics/security.cpp b/apps/openmw/mwmechanics/security.cpp index 3751e5828..bb2e94223 100644 --- a/apps/openmw/mwmechanics/security.cpp +++ b/apps/openmw/mwmechanics/security.cpp @@ -18,8 +18,8 @@ namespace MWMechanics Security::Security(const MWWorld::Ptr &actor) : mActor(actor) { - CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor); - NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats(actor); + CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor); + NpcStats& npcStats = actor.getClass().getNpcStats(actor); mAgility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified(); mLuck = creatureStats.getAttribute(ESM::Attribute::Luck).getModified(); mSecuritySkill = npcStats.getSkill(ESM::Skill::Security).getModified(); @@ -51,10 +51,10 @@ namespace MWMechanics int roll = static_cast (std::rand()) / RAND_MAX * 100; if (roll <= x) { - MWWorld::Class::get(lock).unlock(lock); + lock.getClass().unlock(lock); resultMessage = "#{sLockSuccess}"; resultSound = "Open Lock"; - MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 1); + mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 1); } else resultMessage = "#{sLockFail}"; @@ -97,7 +97,7 @@ namespace MWMechanics resultSound = "Disarm Trap"; resultMessage = "#{sTrapSuccess}"; - MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 0); + mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 0); } else resultMessage = "#{sTrapFail}"; diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 013e3daf4..5e88b2250 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -118,7 +118,7 @@ namespace MWRender 0, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal)); float scale=1.f; - MWWorld::Class::get(mCharacter).adjustScale(mCharacter, scale); + mCharacter.getClass().adjustScale(mCharacter, scale); mNode->setScale(Ogre::Vector3(scale)); mCamera->setPosition(mPosition * mNode->getScale()); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 14f5cc4e7..03ccde388 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -237,7 +237,7 @@ void NpcAnimation::updateNpcBase() void NpcAnimation::updateParts() { mAlpha = 1.f; - const MWWorld::Class &cls = MWWorld::Class::get(mPtr); + const MWWorld::Class &cls = mPtr.getClass(); MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr); NpcType curType = Type_Normal; @@ -668,12 +668,12 @@ void NpcAnimation::showWeapons(bool showWeapon) mShowWeapons = showWeapon; if(showWeapon) { - MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr); + MWWorld::InventoryStore &inv = mPtr.getClass().getInventoryStore(mPtr); MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if(weapon != inv.end()) { Ogre::Vector3 glowColor = getEnchantmentColor(*weapon); - std::string mesh = MWWorld::Class::get(*weapon).getModel(*weapon); + std::string mesh = weapon->getClass().getModel(*weapon); addOrReplaceIndividualPart(ESM::PRT_Weapon, MWWorld::InventoryStore::Slot_CarriedRight, 1, mesh, !weapon->getClass().getEnchantment(*weapon).empty(), &glowColor); @@ -701,13 +701,13 @@ void NpcAnimation::showWeapons(bool showWeapon) void NpcAnimation::showCarriedLeft(bool show) { mShowCarriedLeft = show; - MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr); + MWWorld::InventoryStore &inv = mPtr.getClass().getInventoryStore(mPtr); MWWorld::ContainerStoreIterator iter = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); if(show && iter != inv.end()) { Ogre::Vector3 glowColor = getEnchantmentColor(*iter); - std::string mesh = MWWorld::Class::get(*iter).getModel(*iter); + std::string mesh = iter->getClass().getModel(*iter); if (addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1, mesh, !iter->getClass().getEnchantment(*iter).empty(), &glowColor)) { diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 991ca690e..882a3d09b 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -249,7 +249,7 @@ void RenderingManager::cellAdded (MWWorld::CellStore *store) void RenderingManager::addObject (const MWWorld::Ptr& ptr){ const MWWorld::Class& class_ = - MWWorld::Class::get (ptr); + ptr.getClass(); class_.insertObjectRendering(ptr, *this); } @@ -279,7 +279,7 @@ void RenderingManager::rotateObject(const MWWorld::Ptr &ptr) mCamera->rotateCamera(-rot, false); Ogre::Quaternion newo = Ogre::Quaternion(Ogre::Radian(rot.z), Ogre::Vector3::NEGATIVE_UNIT_Z); - if(!MWWorld::Class::get(ptr).isActor()) + if(!ptr.getClass().isActor()) newo = Ogre::Quaternion(Ogre::Radian(rot.x), Ogre::Vector3::NEGATIVE_UNIT_X) * Ogre::Quaternion(Ogre::Radian(rot.y), Ogre::Vector3::NEGATIVE_UNIT_Y) * newo; ptr.getRefData().getBaseNode()->setOrientation(newo); @@ -294,7 +294,7 @@ RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr & Ogre::SceneNode *parent = child->getParentSceneNode(); parent->removeChild(child); - if (MWWorld::Class::get(old).isActor()) { + if (old.getClass().isActor()) { mActors->updateObjectCell(old, cur); } else { mObjects->updateObjectCell(old, cur); @@ -314,7 +314,7 @@ void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr) NpcAnimation *anim = NULL; if(ptr.getRefData().getHandle() == "player") anim = mPlayerAnimation; - else if(MWWorld::Class::get(ptr).isActor()) + else if(ptr.getClass().isActor()) anim = dynamic_cast(mActors->getAnimation(ptr)); if(anim) { @@ -337,7 +337,7 @@ void RenderingManager::update (float duration, bool paused) MWWorld::Ptr player = world->getPlayerPtr(); - int blind = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude; + int blind = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude; mRendering.getFader()->setFactor(std::max(0.f, 1.f-(blind / 100.f))); setAmbientMode(); @@ -599,7 +599,7 @@ void RenderingManager::setAmbientColour(const Ogre::ColourValue& colour) mAmbientColor = colour; MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - int nightEye = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude; + int nightEye = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude; Ogre::ColourValue final = colour; final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f)); diff --git a/apps/openmw/mwscript/aiextensions.cpp b/apps/openmw/mwscript/aiextensions.cpp index ded25479c..cc17905df 100644 --- a/apps/openmw/mwscript/aiextensions.cpp +++ b/apps/openmw/mwscript/aiextensions.cpp @@ -47,7 +47,7 @@ namespace MWScript for (unsigned int i=0; i @@ -298,7 +298,7 @@ namespace MWScript for (unsigned int i=0; igetPtr (id, false); - script = MWWorld::Class::get (ptr).getScript (ptr); + script = ptr.getClass().getScript (ptr); reference = true; } diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 66c8d4468..6737d6a94 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -117,7 +117,7 @@ namespace MWScript if (count == 0) return; - MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr); + MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr); std::string itemName; for (MWWorld::ContainerStoreIterator iter(store.begin()); iter != store.end(); ++iter) @@ -231,7 +231,7 @@ namespace MWScript throw std::runtime_error ("armor index out of range"); } - MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr); + MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr); MWWorld::ContainerStoreIterator it = invStore.getSlot (slot); if (it == invStore.end() || it->getTypeName () != typeid(ESM::Armor).name()) @@ -240,7 +240,7 @@ namespace MWScript return; } - int skill = MWWorld::Class::get(*it).getEquipmentSkill (*it) ; + int skill = it->getClass().getEquipmentSkill (*it) ; if (skill == ESM::Skill::HeavyArmor) runtime.push(2); else if (skill == ESM::Skill::MediumArmor) @@ -264,7 +264,7 @@ namespace MWScript std::string item = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr); + MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr); for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot) { MWWorld::ContainerStoreIterator it = invStore.getSlot (slot); @@ -290,7 +290,7 @@ namespace MWScript const std::string &name = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr); + MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr); for (MWWorld::ContainerStoreIterator it = invStore.begin(MWWorld::ContainerStore::Type_Miscellaneous); it != invStore.end(); ++it) { @@ -314,7 +314,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr); + MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr); MWWorld::ContainerStoreIterator it = invStore.getSlot (MWWorld::InventoryStore::Slot_CarriedRight); if (it == invStore.end() || it->getTypeName () != typeid(ESM::Weapon).name()) { diff --git a/apps/openmw/mwscript/dialogueextensions.cpp b/apps/openmw/mwscript/dialogueextensions.cpp index a882ae05e..993e99c2e 100644 --- a/apps/openmw/mwscript/dialogueextensions.cpp +++ b/apps/openmw/mwscript/dialogueextensions.cpp @@ -141,7 +141,7 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation () + value); + ptr.getClass().getNpcStats (ptr).setReputation (ptr.getClass().getNpcStats (ptr).getReputation () + value); } }; @@ -156,7 +156,7 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (value); + ptr.getClass().getNpcStats (ptr).setReputation (value); } }; @@ -169,7 +169,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation ()); + runtime.push (ptr.getClass().getNpcStats (ptr).getReputation ()); } }; @@ -184,7 +184,7 @@ namespace MWScript MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).isSameFaction (MWWorld::Class::get(player).getNpcStats (player))); + runtime.push (ptr.getClass().getNpcStats (ptr).isSameFaction (player.getClass().getNpcStats (player))); } }; diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 1f5ad5b07..6f7968fac 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -66,7 +66,7 @@ namespace MWScript { const MWWorld::Ptr ptr = getReference (id, false); - id = MWWorld::Class::get (ptr).getScript (ptr); + id = ptr.getClass().getScript (ptr); ptr.getRefData().setLocals ( *MWBase::Environment::get().getWorld()->getStore().get().find (id)); @@ -86,7 +86,7 @@ namespace MWScript { const MWWorld::Ptr ptr = getReference (id, false); - id = MWWorld::Class::get (ptr).getScript (ptr); + id = ptr.getClass().getScript (ptr); ptr.getRefData().setLocals ( *MWBase::Environment::get().getWorld()->getStore().get().find (id)); @@ -263,7 +263,7 @@ namespace MWScript std::string InterpreterContext::getNPCRank() const { - std::map ranks = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks(); + std::map ranks = mReference.getClass().getNpcStats (mReference).getFactionRanks(); std::map::const_iterator it = ranks.begin(); MWBase::World *world = MWBase::Environment::get().getWorld(); @@ -299,9 +299,9 @@ namespace MWScript MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; + std::string factionId = mReference.getClass().getNpcStats (mReference).getFactionRanks().begin()->first; - std::map ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks(); + std::map ranks = player.getClass().getNpcStats (player).getFactionRanks(); std::map::const_iterator it = ranks.find(factionId); int rank = -1; if (it != ranks.end()) @@ -326,9 +326,9 @@ namespace MWScript MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first; + std::string factionId = mReference.getClass().getNpcStats (mReference).getFactionRanks().begin()->first; - std::map ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks(); + std::map ranks = player.getClass().getNpcStats (player).getFactionRanks(); std::map::const_iterator it = ranks.find(factionId); int rank = -1; if (it != ranks.end()) @@ -353,7 +353,7 @@ namespace MWScript { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - return MWWorld::Class::get (player).getNpcStats (player).getBounty(); + return player.getClass().getNpcStats (player).getBounty(); } std::string InterpreterContext::getCurrentCellName() const diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 620a0d0c9..b0d73253f 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -142,7 +142,7 @@ namespace MWScript runtime.pop(); } - MWWorld::Class::get (ptr).lock (ptr, lockLevel); + ptr.getClass().lock (ptr, lockLevel); } }; @@ -155,7 +155,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - MWWorld::Class::get (ptr).unlock (ptr); + ptr.getClass().unlock (ptr); } }; @@ -345,7 +345,7 @@ namespace MWScript if(key < 0 || key > 32767 || *end != '\0') key = ESM::MagicEffect::effectStringToId(effect); - runtime.push(MWWorld::Class::get(ptr).getCreatureStats(ptr).getMagicEffects().get( + runtime.push(ptr.getClass().getCreatureStats(ptr).getMagicEffects().get( MWMechanics::EffectKey(key)).mMagnitude > 0); } }; @@ -389,7 +389,7 @@ namespace MWScript for (unsigned int i=0; igetCellRef().mSoul, soul)) @@ -424,7 +424,7 @@ namespace MWScript if (amount == 0) return; - MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr); + MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr); int toRemove = amount; @@ -457,7 +457,7 @@ namespace MWScript std::string soul = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr); + MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr); for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter) @@ -481,7 +481,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - runtime.push(MWWorld::Class::get(ptr).getCreatureStats (ptr).getAttacked ()); + runtime.push(ptr.getClass().getCreatureStats (ptr).getAttacked ()); } }; @@ -522,7 +522,7 @@ namespace MWScript std::string id = runtime.getStringLiteral(runtime[0].mInteger); runtime.pop(); - runtime.push(MWWorld::Class::get(ptr).getCreatureStats(ptr).getActiveSpells().isSpellActive(id)); + runtime.push(ptr.getClass().getCreatureStats(ptr).getActiveSpells().isSpellActive(id)); } }; @@ -621,7 +621,7 @@ namespace MWScript std::string objectID = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWMechanics::CreatureStats &stats = MWWorld::Class::get(ptr).getCreatureStats(ptr); + MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr); runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject())); } }; @@ -657,7 +657,7 @@ namespace MWScript { std::stringstream str; - const std::string script = MWWorld::Class::get(ptr).getScript(ptr); + const std::string script = ptr.getClass().getScript(ptr); if(script.empty()) str<< ptr.getCellRef().mRefID<<" ("< stat (MWWorld::Class::get (ptr).getCreatureStats (ptr) + MWMechanics::DynamicStat stat (ptr.getClass().getCreatureStats (ptr) .getDynamic (mIndex)); stat.setModified (value, 0); stat.setCurrent(value); - MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat); + ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat); } }; @@ -222,18 +222,18 @@ namespace MWScript Interpreter::Type_Float diff = runtime[0].mFloat; runtime.pop(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); + MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr); Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent(); - MWMechanics::DynamicStat stat (MWWorld::Class::get (ptr).getCreatureStats (ptr) + MWMechanics::DynamicStat stat (ptr.getClass().getCreatureStats (ptr) .getDynamic (mIndex)); stat.setModified (diff + stat.getModified(), 0); stat.setCurrent (diff + current); - MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat); + ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat); } }; @@ -253,16 +253,16 @@ namespace MWScript Interpreter::Type_Float diff = runtime[0].mFloat; runtime.pop(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); + MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr); Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent(); - MWMechanics::DynamicStat stat (MWWorld::Class::get (ptr).getCreatureStats (ptr) + MWMechanics::DynamicStat stat (ptr.getClass().getCreatureStats (ptr) .getDynamic (mIndex)); stat.setCurrent (diff + current); - MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat); + ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat); } }; @@ -279,7 +279,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); + MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr); Interpreter::Type_Float value = 0; @@ -327,7 +327,7 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWMechanics::NpcStats& stats = MWWorld::Class::get (ptr).getNpcStats (ptr); + MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats (ptr); MWWorld::LiveCellRef *ref = ptr.get(); @@ -386,7 +386,7 @@ namespace MWScript { MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - runtime.push (static_cast (MWWorld::Class::get (player).getNpcStats (player).getBounty())); + runtime.push (static_cast (player.getClass().getNpcStats (player).getBounty())); } }; @@ -399,7 +399,7 @@ namespace MWScript MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat); + player.getClass().getNpcStats (player).setBounty(runtime[0].mFloat); runtime.pop(); } }; @@ -413,7 +413,7 @@ namespace MWScript MWBase::World *world = MWBase::Environment::get().getWorld(); MWWorld::Ptr player = world->getPlayerPtr(); - MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty()); + player.getClass().getNpcStats (player).setBounty(runtime[0].mFloat + player.getClass().getNpcStats (player).getBounty()); runtime.pop(); } }; @@ -433,7 +433,7 @@ namespace MWScript // make sure a spell with this ID actually exists. MWBase::Environment::get().getWorld()->getStore().get().find (id); - MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().add (id); + ptr.getClass().getCreatureStats (ptr).getSpells().add (id); } }; @@ -449,7 +449,7 @@ namespace MWScript std::string id = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().remove (id); + ptr.getClass().getCreatureStats (ptr).getSpells().remove (id); MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager(); @@ -473,7 +473,7 @@ namespace MWScript std::string spellid = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::Class::get (ptr).getCreatureStats (ptr).getActiveSpells().removeEffects(spellid); + ptr.getClass().getCreatureStats (ptr).getActiveSpells().removeEffects(spellid); } }; @@ -489,7 +489,7 @@ namespace MWScript Interpreter::Type_Integer effectId = runtime[0].mInteger; runtime.pop(); - MWWorld::Class::get (ptr).getCreatureStats (ptr).getActiveSpells().purgeEffect(effectId); + ptr.getClass().getCreatureStats (ptr).getActiveSpells().purgeEffect(effectId); } }; @@ -509,8 +509,8 @@ namespace MWScript Interpreter::Type_Integer value = 0; for (MWMechanics::Spells::TIterator iter ( - MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().begin()); - iter!=MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().end(); ++iter) + ptr.getClass().getCreatureStats (ptr).getSpells().begin()); + iter!=ptr.getClass().getCreatureStats (ptr).getSpells().end(); ++iter) if (iter->first==id) { value = 1; @@ -544,9 +544,9 @@ namespace MWScript if(factionID != "") { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) + if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) == player.getClass().getNpcStats(player).getFactionRanks().end()) { - MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; + player.getClass().getNpcStats(player).getFactionRanks()[factionID] = 0; } } } @@ -575,13 +575,13 @@ namespace MWScript if(factionID != "") { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) + if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) == player.getClass().getNpcStats(player).getFactionRanks().end()) { - MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0; + player.getClass().getNpcStats(player).getFactionRanks()[factionID] = 0; } else { - MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] +1; + player.getClass().getNpcStats(player).getFactionRanks()[factionID] = player.getClass().getNpcStats(player).getFactionRanks()[factionID] +1; } } } @@ -610,9 +610,9 @@ namespace MWScript if(factionID != "") { MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) + if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end()) { - MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] -1; + player.getClass().getNpcStats(player).getFactionRanks()[factionID] = player.getClass().getNpcStats(player).getFactionRanks()[factionID] -1; } } } @@ -635,22 +635,22 @@ namespace MWScript } else { - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; } else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } } ::Misc::StringUtils::toLower(factionID); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); if(factionID!="") { - if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end()) + if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end()) { - runtime.push(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID]); + runtime.push(player.getClass().getNpcStats(player).getFactionRanks()[factionID]); } else { @@ -676,8 +676,8 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Class::get (ptr).getNpcStats (ptr).setBaseDisposition - (MWWorld::Class::get (ptr).getNpcStats (ptr).getBaseDisposition() + value); + ptr.getClass().getNpcStats (ptr).setBaseDisposition + (ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value); } }; @@ -693,7 +693,7 @@ namespace MWScript Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Class::get (ptr).getNpcStats (ptr).setBaseDisposition (value); + ptr.getClass().getNpcStats (ptr).setBaseDisposition (value); } }; @@ -739,8 +739,8 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty()) - factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first; + if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) + factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } if (factionId.empty()) @@ -750,7 +750,7 @@ namespace MWScript MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); runtime.push ( - MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)); + player.getClass().getNpcStats (player).getFactionReputation (factionId)); } }; @@ -775,8 +775,8 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty()) - factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first; + if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) + factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } if (factionId.empty()) @@ -785,7 +785,7 @@ namespace MWScript ::Misc::StringUtils::toLower (factionId); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value); + player.getClass().getNpcStats (player).setFactionReputation (factionId, value); } }; @@ -810,8 +810,8 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty()) - factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first; + if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty()) + factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first; } if (factionId.empty()) @@ -820,8 +820,8 @@ namespace MWScript ::Misc::StringUtils::toLower (factionId); MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); - MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, - MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)+ + player.getClass().getNpcStats (player).setFactionReputation (factionId, + player.getClass().getNpcStats (player).getFactionReputation (factionId)+ value); } }; @@ -835,7 +835,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasCommonDisease()); + runtime.push (ptr.getClass().getCreatureStats (ptr).hasCommonDisease()); } }; @@ -848,7 +848,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasBlightDisease()); + runtime.push (ptr.getClass().getCreatureStats (ptr).hasBlightDisease()); } }; @@ -880,7 +880,7 @@ namespace MWScript { MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ()); + runtime.push (ptr.getClass().getNpcStats (ptr).getWerewolfKills ()); } }; @@ -901,13 +901,13 @@ namespace MWScript } else { - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; } else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } } ::Misc::StringUtils::toLower(factionID); @@ -939,13 +939,13 @@ namespace MWScript else { MWWorld::Ptr ptr = R()(runtime); - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; } else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } } MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); @@ -972,13 +972,13 @@ namespace MWScript else { MWWorld::Ptr ptr = R()(runtime); - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) { factionID = ""; } else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } } MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); @@ -997,11 +997,11 @@ namespace MWScript MWWorld::Ptr ptr = R()(runtime); std::string factionID = ""; - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) return; else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); @@ -1009,7 +1009,7 @@ namespace MWScript if (ptr == player) return; - std::map& ranks = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks (); + std::map& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks (); ranks[factionID] = ranks[factionID]+1; } }; @@ -1024,11 +1024,11 @@ namespace MWScript MWWorld::Ptr ptr = R()(runtime); std::string factionID = ""; - if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty()) + if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty()) return; else { - factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first; + factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first; } MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr(); @@ -1036,7 +1036,7 @@ namespace MWScript if (ptr == player) return; - std::map& ranks = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks (); + std::map& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks (); ranks[factionID] = ranks[factionID]-1; } }; @@ -1051,10 +1051,10 @@ namespace MWScript MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied(); + ptr.getClass().getCreatureStats (ptr).hasDied(); if (value) - MWWorld::Class::get (ptr).getCreatureStats (ptr).clearHasDied(); + ptr.getClass().getCreatureStats (ptr).clearHasDied(); runtime.push (value); } @@ -1070,7 +1070,7 @@ namespace MWScript MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getCreatureStats (ptr).getKnockedDownOneFrame(); + ptr.getClass().getCreatureStats (ptr).getKnockedDownOneFrame(); runtime.push (value); } @@ -1084,7 +1084,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { MWWorld::Ptr ptr = R()(runtime); - runtime.push(MWWorld::Class::get(ptr).getNpcStats(ptr).isWerewolf()); + runtime.push(ptr.getClass().getNpcStats(ptr).isWerewolf()); } }; diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index e4c1a2677..fb27e73f4 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -319,7 +319,7 @@ namespace MWScript } MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot); - MWWorld::Class::get(ptr).adjustPosition(ptr); + ptr.getClass().adjustPosition(ptr); } else { @@ -366,7 +366,7 @@ namespace MWScript zRot = zRot/60.; } MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot); - MWWorld::Class::get(ptr).adjustPosition(ptr); + ptr.getClass().adjustPosition(ptr); } }; diff --git a/apps/openmw/mwworld/actionapply.cpp b/apps/openmw/mwworld/actionapply.cpp index bd3e87548..6b12cc3e6 100644 --- a/apps/openmw/mwworld/actionapply.cpp +++ b/apps/openmw/mwworld/actionapply.cpp @@ -16,7 +16,7 @@ namespace MWWorld { MWBase::Environment::get().getWorld()->breakInvisibility(actor); - MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor); + getTarget().getClass().apply (getTarget(), mId, actor); } @@ -29,7 +29,7 @@ namespace MWWorld { MWBase::Environment::get().getWorld()->breakInvisibility(actor); - if (MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor) && mUsageType!=-1) - MWWorld::Class::get (getTarget()).skillUsageSucceeded (actor, mSkillIndex, mUsageType); + if (getTarget().getClass().apply (getTarget(), mId, actor) && mUsageType!=-1) + getTarget().getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType); } } diff --git a/apps/openmw/mwworld/actioneat.cpp b/apps/openmw/mwworld/actioneat.cpp index 020bdb0ff..660915523 100644 --- a/apps/openmw/mwworld/actioneat.cpp +++ b/apps/openmw/mwworld/actioneat.cpp @@ -20,10 +20,10 @@ namespace MWWorld getTarget().getContainerStore()->remove(getTarget(), 1, actor); // apply to actor - std::string id = Class::get (getTarget()).getId (getTarget()); + std::string id = getTarget().getClass().getId (getTarget()); - if (Class::get (actor).apply (actor, id, actor)) - Class::get (actor).skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1); + if (actor.getClass().apply (actor, id, actor)) + actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1); } ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {} diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index 2a1b7a3aa..05677cdc7 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -40,7 +40,7 @@ namespace MWWorld } // slots that this item can be equipped in - std::pair, bool> slots_ = MWWorld::Class::get(getTarget()).getEquipmentSlots(getTarget()); + std::pair, bool> slots_ = getTarget().getClass().getEquipmentSlots(getTarget()); // retrieve ContainerStoreIterator to the item MWWorld::ContainerStoreIterator it = invStore.begin(); diff --git a/apps/openmw/mwworld/actionread.cpp b/apps/openmw/mwworld/actionread.cpp index 60af3d9b9..0a4e2d6c9 100644 --- a/apps/openmw/mwworld/actionread.cpp +++ b/apps/openmw/mwworld/actionread.cpp @@ -47,7 +47,7 @@ namespace MWWorld } MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr(); - MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); + MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player); // Skill gain from books if (ref->mBase->mData.mSkillID >= 0 && ref->mBase->mData.mSkillID < ESM::Skill::Length diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index aa247f0b9..04d733e2c 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -36,7 +36,7 @@ namespace MWWorld::Ptr container (&*iter, 0); MWWorld::Ptr ptr = - MWWorld::Class::get (container).getContainerStore (container).search (id); + container.getClass().getContainerStore (container).search (id); if (!ptr.isEmpty()) return ptr; diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 951ba7865..6629f84f9 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -323,7 +323,7 @@ namespace MWWorld if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) return boost::shared_ptr(new NullAction()); - if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) + if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 0b1eb857c..b47028e01 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -325,12 +325,6 @@ namespace MWWorld static const Class& get (const std::string& key); ///< If there is no class for this \a key, an exception is thrown. - static const Class& get (const Ptr& ptr) - { - return ptr.getClass(); - } - ///< If there is no class for this pointer, an exception is thrown. - static void registerClass (const std::string& key, boost::shared_ptr instance); virtual int getBaseGold(const MWWorld::Ptr& ptr) const; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 8f2a56646..d816f993b 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -142,8 +142,8 @@ void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container) bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) { - const MWWorld::Class& cls1 = MWWorld::Class::get(ptr1); - const MWWorld::Class& cls2 = MWWorld::Class::get(ptr2); + const MWWorld::Class& cls1 = ptr1.getClass(); + const MWWorld::Class& cls2 = ptr2.getClass(); if (!Misc::StringUtils::ciEqual(ptr1.getCellRef().mRefID, ptr2.getCellRef().mRefID)) return false; @@ -226,14 +226,14 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr item.getCellRef().mPos.pos[1] = 0; item.getCellRef().mPos.pos[2] = 0; - std::string script = MWWorld::Class::get(item).getScript(item); + std::string script = item.getClass().getScript(item); if(script != "") { CellStore *cell; MWBase::Environment::get().getWorld()->getLocalScripts().add(script, item); - if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) + if(&(player.getClass().getContainerStore (player)) == this) { cell = 0; // Items in player's inventory have cell set to 0, so their scripts will never be removed diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 7127c92f3..78a295030 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -129,7 +129,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite std::pair, bool> slots_; - slots_ = Class::get (*iterator).getEquipmentSlots (*iterator); + slots_ = iterator->getClass().getEquipmentSlots (*iterator); if (std::find (slots_.first.begin(), slots_.first.end(), slot)==slots_.first.end()) throw std::runtime_error ("invalid slot"); @@ -258,7 +258,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor) } } - switch(MWWorld::Class::get (test).canBeEquipped (test, actor).first) + switch(test.getClass().canBeEquipped (test, actor).first) { case 0: continue; @@ -325,7 +325,7 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor) if (*iter==end()) continue; - std::string enchantmentId = MWWorld::Class::get (**iter).getEnchantment (**iter); + std::string enchantmentId = (*iter)->getClass().getEnchantment (**iter); if (!enchantmentId.empty()) { @@ -441,7 +441,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2) { if (*iter != end() && (ptr1 == **iter || ptr2 == **iter)) { - bool stackWhenEquipped = MWWorld::Class::get(**iter).getEquipmentSlots(**iter).second; + bool stackWhenEquipped = (*iter)->getClass().getEquipmentSlots(**iter).second; if (!stackWhenEquipped) return false; } @@ -527,7 +527,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c if (actor.getRefData().getHandle() == "player") { // Unset OnPCEquip Variable on item's script, if it has a script with that variable declared - const std::string& script = Class::get(*it).getScript(*it); + const std::string& script = it->getClass().getScript(*it); if (script != "") (*it).getRefData().getLocals().setVarByInt(script, "onpcequip", 0); @@ -579,7 +579,7 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito if (*iter==end()) continue; - std::string enchantmentId = MWWorld::Class::get (**iter).getEnchantment (**iter); + std::string enchantmentId = (*iter)->getClass().getEnchantment (**iter); if (enchantmentId.empty()) continue; diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index 844e2b18b..8a671cea8 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -36,10 +36,10 @@ namespace MWWorld::Ptr containerPtr (&*iter, cell); - MWWorld::ContainerStore& container = MWWorld::Class::get(containerPtr).getContainerStore(containerPtr); + MWWorld::ContainerStore& container = containerPtr.getClass().getContainerStore(containerPtr); for(MWWorld::ContainerStoreIterator it3 = container.begin(); it3 != container.end(); ++it3) { - std::string script = MWWorld::Class::get(*it3).getScript(*it3); + std::string script = it3->getClass().getScript(*it3); if(script != "") { MWWorld::Ptr item = *it3; diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index ced952861..039fce0ca 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -538,7 +538,7 @@ namespace MWWorld void PhysicsSystem::addObject (const Ptr& ptr, bool placeable) { - std::string mesh = MWWorld::Class::get(ptr).getModel(ptr); + std::string mesh = ptr.getClass().getModel(ptr); Ogre::SceneNode* node = ptr.getRefData().getBaseNode(); handleToMesh[node->getName()] = mesh; OEngine::Physic::RigidBody* body = mEngine->createAndAdjustRigidBody( @@ -550,7 +550,7 @@ namespace MWWorld void PhysicsSystem::addActor (const Ptr& ptr) { - std::string mesh = MWWorld::Class::get(ptr).getModel(ptr); + std::string mesh = ptr.getClass().getModel(ptr); Ogre::SceneNode* node = ptr.getRefData().getBaseNode(); //TODO:optimize this. Searching the std::map isn't very efficient i think. mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation()); @@ -651,7 +651,7 @@ namespace MWWorld bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max) { - std::string model = MWWorld::Class::get(ptr).getModel(ptr); + std::string model = ptr.getClass().getModel(ptr); if (model.empty()) { return false; } diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 1f994d013..5ca8f2952 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -75,7 +75,7 @@ namespace MWWorld void Player::setDrawState (MWMechanics::DrawState_ state) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get(ptr).getNpcStats(ptr).setDrawState (state); + ptr.getClass().getNpcStats(ptr).setDrawState (state); } bool Player::getAutoMove() const @@ -94,13 +94,13 @@ namespace MWWorld if (mAutoMove) value = 1; - MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value; + ptr.getClass().getMovementSettings (ptr).mPosition[1] = value; } void Player::setLeftRight (int value) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[0] = value; + ptr.getClass().getMovementSettings (ptr).mPosition[0] = value; } void Player::setForwardBackward (int value) @@ -112,13 +112,13 @@ namespace MWWorld if (mAutoMove) value = 1; - MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value; + ptr.getClass().getMovementSettings (ptr).mPosition[1] = value; } void Player::setUpDown(int value) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[2] = value; + ptr.getClass().getMovementSettings (ptr).mPosition[2] = value; } void Player::setRunState(bool run) @@ -136,23 +136,23 @@ namespace MWWorld void Player::yaw(float yaw) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[2] += yaw; + ptr.getClass().getMovementSettings(ptr).mRotation[2] += yaw; } void Player::pitch(float pitch) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[0] += pitch; + ptr.getClass().getMovementSettings(ptr).mRotation[0] += pitch; } void Player::roll(float roll) { MWWorld::Ptr ptr = getPlayer(); - MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[1] += roll; + ptr.getClass().getMovementSettings(ptr).mRotation[1] += roll; } MWMechanics::DrawState_ Player::getDrawState() { MWWorld::Ptr ptr = getPlayer(); - return MWWorld::Class::get(ptr).getNpcStats(ptr).getDrawState(); + return ptr.getClass().getNpcStats(ptr).getDrawState(); } bool Player::wasTeleported() const diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 25ee0c2e8..122a6f9bf 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -198,7 +198,7 @@ namespace MWWorld float z = Ogre::Radian(pos.rot[2]).valueDegrees(); world->rotateObject(player, x, y, z); - MWWorld::Class::get(player).adjustPosition(player); + player.getClass().adjustPosition(player); } MWBase::MechanicsManager *mechMgr = @@ -399,7 +399,7 @@ namespace MWWorld float z = Ogre::Radian(position.rot[2]).valueDegrees(); world->rotateObject(world->getPlayerPtr(), x, y, z); - MWWorld::Class::get(world->getPlayerPtr()).adjustPosition(world->getPlayerPtr()); + world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr()); world->getFader()->fadeIn(0.5f); return; } @@ -482,7 +482,7 @@ namespace MWWorld void Scene::addObjectToScene (const Ptr& ptr) { mRendering.addObject(ptr); - MWWorld::Class::get(ptr).insertObject(ptr, *mPhysics); + ptr.getClass().insertObject(ptr, *mPhysics); MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true); MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().mScale); } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 9b5f9d9d3..5a83a5bc7 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -537,8 +537,8 @@ namespace MWWorld return ptr; } - Ptr ptr = Class::get (mPlayer->getPlayer()). - getContainerStore (mPlayer->getPlayer()).search (lowerCaseName); + Ptr ptr = mPlayer->getPlayer().getClass() + .getContainerStore(mPlayer->getPlayer()).search(lowerCaseName); if (!ptr.isEmpty()) return ptr; @@ -589,10 +589,10 @@ namespace MWWorld reference.getTypeName()==typeid (ESM::NPC).name() || reference.getTypeName()==typeid (ESM::Creature).name()) { - MWWorld::ContainerStore& container = MWWorld::Class::get(reference).getContainerStore(reference); + MWWorld::ContainerStore& container = reference.getClass().getContainerStore(reference); for(MWWorld::ContainerStoreIterator it = container.begin(); it != container.end(); ++it) { - std::string script = MWWorld::Class::get(*it).getScript(*it); + std::string script = it->getClass().getScript(*it); if(script != "") { MWWorld::Ptr item = *it; @@ -624,10 +624,10 @@ namespace MWWorld reference.getTypeName()==typeid (ESM::NPC).name() || reference.getTypeName()==typeid (ESM::Creature).name()) { - MWWorld::ContainerStore& container = MWWorld::Class::get(reference).getContainerStore(reference); + MWWorld::ContainerStore& container = reference.getClass().getContainerStore(reference); for(MWWorld::ContainerStoreIterator it = container.begin(); it != container.end(); ++it) { - std::string script = MWWorld::Class::get(*it).getScript(*it); + std::string script = it->getClass().getScript(*it); if(script != "") { MWWorld::Ptr item = *it; @@ -976,14 +976,14 @@ namespace MWWorld removeContainerScripts (ptr); haveToMove = false; - MWWorld::Ptr newPtr = MWWorld::Class::get(ptr) + MWWorld::Ptr newPtr = ptr.getClass() .copyToCell(ptr, *newCell); newPtr.getRefData().setBaseNode(0); } else { MWWorld::Ptr copy = - MWWorld::Class::get(ptr).copyToCell(ptr, *newCell, pos); + ptr.getClass().copyToCell(ptr, *newCell, pos); mRendering->updateObjectCell(ptr, copy); MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy); @@ -992,7 +992,7 @@ namespace MWWorld mechMgr->updateCell(ptr, copy); std::string script = - MWWorld::Class::get(ptr).getScript(ptr); + ptr.getClass().getScript(ptr); if (!script.empty()) { mLocalScripts.remove(ptr); @@ -1035,7 +1035,7 @@ namespace MWWorld void World::scaleObject (const Ptr& ptr, float scale) { ptr.getCellRef().mScale = scale; - MWWorld::Class::get(ptr).adjustScale(ptr,scale); + ptr.getClass().adjustScale(ptr,scale); if(ptr.getRefData().getBaseNode() == 0) return; @@ -1062,7 +1062,7 @@ namespace MWWorld objRot[2] = rot.z; } - if(Class::get(ptr).isActor()) + if(ptr.getClass().isActor()) { /* HACK? Actors shouldn't really be rotating around X (or Y), but * currently it's done so for rotating the camera, which needs @@ -1580,7 +1580,7 @@ namespace MWWorld void World::PCDropped (const Ptr& item) { - std::string script = MWWorld::Class::get(item).getScript(item); + std::string script = item.getClass().getScript(item); // Set OnPCDrop Variable on item's script, if it has a script with that variable declared if(script != "") @@ -1648,13 +1648,13 @@ namespace MWWorld } MWWorld::Ptr dropped = - MWWorld::Class::get(object).copyToCell(object, *cell, pos); + object.getClass().copyToCell(object, *cell, pos); if (mWorldScene->isCellActive(*cell)) { if (dropped.getRefData().isEnabled()) { mWorldScene->addObjectToScene(dropped); } - std::string script = MWWorld::Class::get(dropped).getScript(dropped); + std::string script = dropped.getClass().getScript(dropped); if (!script.empty()) { mLocalScripts.add(script, dropped); } @@ -1863,7 +1863,7 @@ namespace MWWorld if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos)) return 2; if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || - Class::get(player).getNpcStats(player).isWerewolf()) + player.getClass().getNpcStats(player).isWerewolf()) return 1; return 0; @@ -2107,7 +2107,7 @@ namespace MWWorld void World::setWerewolf(const MWWorld::Ptr& actor, bool werewolf) { - MWMechanics::NpcStats& npcStats = Class::get(actor).getNpcStats(actor); + MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats(actor); // The actor does not have to change state if (npcStats.isWerewolf() == werewolf) @@ -2119,7 +2119,7 @@ namespace MWWorld // bones that do not even exist with the werewolf object root. // Therefore, make sure to unequip everything at once, and only fire the change event // (which will rebuild the animation parts) afterwards. unequipAll will do this for us. - MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor); + MWWorld::InventoryStore& invStore = actor.getClass().getInventoryStore(actor); invStore.unequipAll(actor); if(werewolf) @@ -2158,7 +2158,7 @@ namespace MWWorld void World::applyWerewolfAcrobatics(const Ptr &actor) { const Store &gmst = getStore().get(); - MWMechanics::NpcStats &stats = Class::get(actor).getNpcStats(actor); + MWMechanics::NpcStats &stats = actor.getClass().getNpcStats(actor); stats.getSkill(ESM::Skill::Acrobatics).setBase(gmst.find("fWerewolfAcrobatics")->getFloat()); }