mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
Use player reference instead of pointer
This commit is contained in:
parent
acd3cba5fa
commit
9c45cc7e48
1 changed files with 7 additions and 8 deletions
|
@ -257,15 +257,14 @@ namespace MWMechanics
|
|||
if (newItem.isEmpty() || boundPtr != newItem)
|
||||
return;
|
||||
|
||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||
|
||||
// change draw state only if the item is in player's right hand
|
||||
if (slot == MWWorld::InventoryStore::Slot_CarriedRight)
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
||||
player.setDrawState(MWMechanics::DrawState_Weapon);
|
||||
|
||||
if (prevItem != store.end())
|
||||
{
|
||||
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
||||
player->setPreviousItem(itemId, prevItem->getCellRef().getRefId());
|
||||
}
|
||||
player.setPreviousItem(itemId, prevItem->getCellRef().getRefId());
|
||||
}
|
||||
|
||||
void Actors::removeBoundItem (const std::string& itemId, const MWWorld::Ptr& actor)
|
||||
|
@ -282,9 +281,9 @@ namespace MWMechanics
|
|||
if (actor != MWMechanics::getPlayer())
|
||||
return;
|
||||
|
||||
MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer();
|
||||
std::string prevItemId = player->getPreviousItem(itemId);
|
||||
player->erasePreviousItem(itemId);
|
||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||
std::string prevItemId = player.getPreviousItem(itemId);
|
||||
player.erasePreviousItem(itemId);
|
||||
|
||||
if (prevItemId.empty())
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue