Commit 77a1d947 authored by dteviot's avatar dteviot

extracted MWMechanics::getPlayer()

parent 0ee74071
......@@ -78,7 +78,7 @@ add_openmw_dir (mwclass
)
add_openmw_dir (mwmechanics
mechanicsmanagerimp stat creaturestats magiceffects movement
mechanicsmanagerimp stat creaturestats magiceffects movement actorutil
drawstate spells activespells npcstats aipackage aisequence aipursue alchemy aiwander aitravel aifollow aiavoiddoor
aiescort aiactivate aicombat repair enchanting pathfinding pathgrid security spellsuccess spellcasting
disease pickpocket levelledlist combat steering obstacle autocalcspell difficultyscaling aicombataction actor summoning
......
......@@ -20,6 +20,7 @@
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwgui/tooltips.hpp"
......@@ -244,7 +245,7 @@ namespace MWClass
typeText = "#{sHeavy}";
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(getEffectiveArmorRating(ptr,
MWBase::Environment::get().getWorld()->getPlayerPtr()));
MWMechanics::getPlayer()));
int remainingHealth = getItemHealth(ptr);
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(remainingHealth) + "/"
......
......@@ -36,6 +36,7 @@
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/combat.hpp"
#include "../mwmechanics/actorutil.hpp"
namespace
{
......@@ -344,7 +345,7 @@ namespace MWClass
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
{
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
......
......@@ -26,6 +26,8 @@
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwmechanics/actorutil.hpp"
namespace
{
struct DoorCustomData : public MWWorld::CustomData
......@@ -126,7 +128,7 @@ namespace MWClass
if (needKey && hasKey)
{
if(actor == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(actor == MWMechanics::getPlayer())
MWBase::Environment::get().getWindowManager()->messageBox(keyName + " #{sKeyUsed}");
unlock(ptr); //Call the function here. because that makes sense.
// using a key disarms the trap
......
......@@ -24,6 +24,7 @@
#include "../mwmechanics/autocalcspell.hpp"
#include "../mwmechanics/difficultyscaling.hpp"
#include "../mwmechanics/character.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp"
......@@ -503,7 +504,7 @@ namespace MWClass
if(otherstats.isDead()) // Can't hit dead actors
return;
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(ptr == MWMechanics::getPlayer())
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
int weapskill = ESM::Skill::HandToHand;
......@@ -542,7 +543,7 @@ namespace MWClass
{
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg, attackStrength);
}
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(ptr == MWMechanics::getPlayer())
{
skillUsageSucceeded(ptr, weapskill, 0);
......@@ -608,7 +609,7 @@ namespace MWClass
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitAttemptObject(object.getClass().getId(object));
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWMechanics::getPlayer())
{
const std::string &script = ptr.getClass().getScript(ptr);
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
......@@ -700,7 +701,7 @@ namespace MWClass
if (armorhealth == 0)
armor = *inv.unequipItem(armor, ptr);
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
if (ptr == MWMechanics::getPlayer())
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
switch(armor.getClass().getEquipmentSkill(armor))
......@@ -716,7 +717,7 @@ namespace MWClass
break;
}
}
else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
else if(ptr == MWMechanics::getPlayer())
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
}
}
......@@ -729,7 +730,7 @@ namespace MWClass
if(damage > 0.0f)
{
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
if (ptr == MWMechanics::getPlayer())
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
}
MWMechanics::DynamicStat<float> health(getCreatureStats(ptr).getHealth());
......@@ -783,7 +784,7 @@ namespace MWClass
const MWWorld::Ptr& actor) const
{
// player got activated by another NPC
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
if(ptr == MWMechanics::getPlayer())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
// Werewolfs can't activate NPCs
......
......@@ -41,6 +41,7 @@
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "filter.hpp"
#include "hypertextparser.hpp"
......@@ -532,7 +533,7 @@ namespace MWDialogue
else if (curDisp + mTemporaryDispositionChange > 100)
mTemporaryDispositionChange = 100 - curDisp;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
player.getClass().skillUsageSucceeded(player, ESM::Skill::Speechcraft, success ? 0 : 1);
if (success)
......
......@@ -17,6 +17,7 @@
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/magiceffects.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "selectwrapper.hpp"
......@@ -97,7 +98,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
{
const MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWWorld::Ptr player = MWMechanics::getPlayer();
// check player faction
if (!info.mPcFaction.empty())
......@@ -219,7 +220,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
case SelectWrapper::Function_PcHealthPercent:
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
float ratio = player.getClass().getCreatureStats (player).getHealth().getCurrent() /
player.getClass().getCreatureStats (player).getHealth().getModified();
......@@ -229,7 +230,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
case SelectWrapper::Function_PcDynamicStat:
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
float value = player.getClass().getCreatureStats (player).
getDynamic (select.getArgument()).getCurrent();
......@@ -253,7 +254,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) const
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
switch (select.getFunction())
{
......@@ -429,7 +430,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) const
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
switch (select.getFunction())
{
......@@ -532,7 +533,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_ShouldAttack:
return MWBase::Environment::get().getMechanicsManager()->isAggressive(mActor,
MWBase::Environment::get().getWorld()->getPlayerPtr());
MWMechanics::getPlayer());
case SelectWrapper::Function_Werewolf:
......
......@@ -11,6 +11,7 @@
#include "../mwmechanics/magiceffects.hpp"
#include "../mwmechanics/alchemy.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
......@@ -124,9 +125,9 @@ namespace MWGui
void AlchemyWindow::open()
{
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
mAlchemy->setAlchemist (MWMechanics::getPlayer());
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr());
InventoryItemModel* model = new InventoryItemModel(MWMechanics::getPlayer());
mSortModel = new SortFilterItemModel(model);
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
mItemView->setModel (mSortModel);
......@@ -136,7 +137,7 @@ namespace MWGui
int index = 0;
mAlchemy->setAlchemist (MWBase::Environment::get().getWorld()->getPlayerPtr());
mAlchemy->setAlchemist (MWMechanics::getPlayer());
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy->beginTools());
iter!=mAlchemy->endTools() && index<static_cast<int> (mApparatus.size()); ++iter, ++index)
......
......@@ -9,6 +9,8 @@
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/actiontake.hpp"
#include "formatting.hpp"
......@@ -123,7 +125,7 @@ namespace MWGui
MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0);
MWWorld::ActionTake take(mBook);
take.execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
take.execute (MWMechanics::getPlayer());
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
}
......
......@@ -7,6 +7,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/fallback.hpp"
......@@ -51,7 +52,7 @@ namespace
void updatePlayerHealth()
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
npcStats.updateHealth();
}
......@@ -228,7 +229,7 @@ namespace MWGui
mReviewDialog->setBirthSign(mPlayerBirthSignId);
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
mReviewDialog->setHealth ( stats.getHealth() );
......
......@@ -9,6 +9,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/class.hpp"
......@@ -137,7 +138,7 @@ namespace MWGui
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
{
// we are stealing stuff
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
mModel = new PickpocketItemModel(player, new InventoryItemModel(container),
!mPtr.getClass().getCreatureStats(mPtr).getKnockedDown());
}
......@@ -183,7 +184,7 @@ namespace MWGui
&& !mPickpocketDetected
)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWMechanics::Pickpocket pickpocket(player, mPtr);
if (pickpocket.finish())
{
......@@ -260,7 +261,7 @@ namespace MWGui
bool ContainerWindow::onTakeItem(const ItemStack &item, int count)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
// TODO: move to ItemModels
if (dynamic_cast<PickpocketItemModel*>(mModel)
&& !mPtr.getClass().getCreatureStats(mPtr).getKnockedDown())
......
......@@ -21,6 +21,7 @@
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "widgets.hpp"
#include "bookpage.hpp"
......@@ -89,7 +90,7 @@ namespace MWGui
WindowModal::open();
center();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mBribe10Button->setEnabled (playerGold >= 10);
......
......@@ -18,6 +18,8 @@
#include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "itemselection.hpp"
#include "itemwidget.hpp"
......@@ -160,7 +162,7 @@ namespace MWGui
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
mEnchanting.setSelfEnchanting(true);
mEnchanting.setEnchanter(player);
......@@ -208,7 +210,7 @@ namespace MWGui
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
mItemSelectionDialog->setVisible(true);
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable);
}
else
......@@ -263,7 +265,7 @@ namespace MWGui
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
mItemSelectionDialog->setVisible(true);
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones);
//MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
......@@ -324,7 +326,7 @@ namespace MWGui
mEnchanting.setNewItemName(mName->getCaption());
mEnchanting.setEffect(mEffectList);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
if (mPtr != player && mEnchanting.getEnchantPrice() > playerGold)
{
......
......@@ -18,6 +18,7 @@
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "inventorywindow.hpp"
#include "spellicons.hpp"
......@@ -259,7 +260,7 @@ namespace MWGui
{
// drop item into the gameworld
MWBase::Environment::get().getWorld()->breakInvisibility(
MWBase::Environment::get().getWorld()->getPlayerPtr());
MWMechanics::getPlayer());
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
......@@ -338,7 +339,7 @@ namespace MWGui
void HUD::onWeaponClicked(MyGUI::Widget* _sender)
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWWorld::Ptr& player = MWMechanics::getPlayer();
if (player.getClass().getNpcStats(player).isWerewolf())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
......@@ -350,7 +351,7 @@ namespace MWGui
void HUD::onMagicClicked(MyGUI::Widget* _sender)
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWWorld::Ptr& player = MWMechanics::getPlayer();
if (player.getClass().getNpcStats(player).isWerewolf())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
......
......@@ -29,6 +29,8 @@
#include "../mwscript/interpretercontext.hpp"
#include "../mwrender/characterpreview.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "itemview.hpp"
#include "inventoryitemmodel.hpp"
#include "sortfilteritemmodel.hpp"
......@@ -63,7 +65,7 @@ namespace MWGui
, mGuiMode(GM_Inventory)
, mLastXSize(0)
, mLastYSize(0)
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWBase::Environment::get().getWorld()->getPlayerPtr()))
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWMechanics::getPlayer()))
, mTrading(false)
{
mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));
......@@ -333,7 +335,7 @@ namespace MWGui
void InventoryWindow::open()
{
mPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
mPtr = MWMechanics::getPlayer();
updateEncumbranceBar();
......@@ -439,7 +441,7 @@ namespace MWGui
{
const std::string& script = ptr.getClass().getScript(ptr);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
// early-out for items that need to be equipped, but can't be equipped: we don't want to set OnPcEquip in that case
if (!ptr.getClass().getEquipmentSlots(ptr).first.empty())
......@@ -549,7 +551,7 @@ namespace MWGui
void InventoryWindow::updateEncumbranceBar()
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
float capacity = player.getClass().getCapacity(player);
float encumbrance = player.getClass().getEncumbrance(player);
......@@ -583,7 +585,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
MWBase::Environment::get().getWorld()->getPlayerPtr());
MWMechanics::getPlayer());
dirtyPreview();
}
......@@ -614,7 +616,7 @@ namespace MWGui
int count = object.getRefData().getCount();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWBase::Environment::get().getWorld()->breakInvisibility(player);
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, object, MWWorld::Ptr(), count);
......@@ -644,7 +646,7 @@ namespace MWGui
{
ItemModel::ModelIndex selected = -1;
// not using mSortFilterModel as we only need sorting, not filtering
SortFilterItemModel model(new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayerPtr()));
SortFilterItemModel model(new InventoryItemModel(MWMechanics::getPlayer()));
model.setSortByType(false);
model.update();
if (model.getItemCount() == 0)
......
......@@ -8,6 +8,7 @@
#include "../mwbase/environment.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/store.hpp"
......@@ -57,7 +58,7 @@ namespace MWGui
if (mFadeTimeRemaining <= 0)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWBase::Environment::get().getWorld()->teleportToClosestMarker(player, "prisonmarker");
setVisible(true);
......@@ -76,7 +77,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Jail);
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWBase::Environment::get().getWorld()->advanceTime(mDays * 24);
for (int i=0; i<mDays*24; ++i)
......
......@@ -16,6 +16,7 @@
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actorutil.hpp"
namespace MWGui
{
......@@ -203,7 +204,7 @@ namespace MWGui
void LevelupDialog::onOkButtonClicked(MyGUI::Widget* sender)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
if (mSpentAttributes.size() < mCoinCount)
......
......@@ -13,6 +13,7 @@
#include "../mwbase/soundmanager.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/containerstore.hpp"
......@@ -40,7 +41,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
int currentY = 0;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
......@@ -125,7 +126,7 @@ void MerchantRepair::exit()
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
int price = MyGUI::utility::parseInt(sender->getUserString("Price"));
if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId))
......
......@@ -19,6 +19,7 @@
#include "../mwmechanics/spellcasting.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "../mwgui/inventorywindow.hpp"
......@@ -147,7 +148,7 @@ namespace MWGui
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &QuickKeysMenu::onAssignItemCancel);
}
mItemSelectionDialog->setVisible(true);
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayerPtr());
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyUsableItems);
mAssignDialog->setVisible (false);
......@@ -262,7 +263,7 @@ namespace MWGui
QuickKeyType type = mAssigned[index-1];
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr player = MWMechanics::getPlayer();
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
if (type == Type_Item || type == Type_MagicItem)
......@@ -473,7 +474,7 @@ namespace MWGui