mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 06:39:49 +00:00
03cf383be7
Conflicts: apps/openmw/mwgui/referenceinterface.cpp apps/openmw/mwmechanics/actors.cpp apps/openmw/mwmechanics/mechanicsmanagerimp.cpp apps/openmw/mwmechanics/mechanicsmanagerimp.hpp apps/openmw/mwscript/cellextensions.cpp apps/openmw/mwworld/cells.cpp apps/openmw/mwworld/cells.hpp apps/openmw/mwworld/cellstore.cpp apps/openmw/mwworld/store.cpp apps/openmw/mwworld/worldimp.cpp
35 lines
887 B
C++
35 lines
887 B
C++
#include "referenceinterface.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
namespace MWGui
|
|
{
|
|
ReferenceInterface::ReferenceInterface()
|
|
: mCurrentPlayerCell(NULL)
|
|
{
|
|
}
|
|
|
|
ReferenceInterface::~ReferenceInterface()
|
|
{
|
|
}
|
|
|
|
void ReferenceInterface::checkReferenceAvailable()
|
|
{
|
|
MWWorld::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell();
|
|
|
|
// check if player has changed cell, or count of the reference has become 0
|
|
if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL)
|
|
|| (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0))
|
|
{
|
|
if (!mPtr.isEmpty())
|
|
{
|
|
mPtr = MWWorld::Ptr();
|
|
onReferenceUnavailable();
|
|
}
|
|
}
|
|
|
|
mCurrentPlayerCell = playerCell;
|
|
}
|
|
}
|