2012-05-26 23:14:33 +00:00
|
|
|
#include "referenceinterface.hpp"
|
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-05-26 23:14:33 +00:00
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
#include "../mwworld/player.hpp"
|
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
ReferenceInterface::ReferenceInterface()
|
|
|
|
: mCurrentPlayerCell(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-06 23:14:18 +00:00
|
|
|
ReferenceInterface::~ReferenceInterface()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-26 23:14:33 +00:00
|
|
|
void ReferenceInterface::checkReferenceAvailable()
|
|
|
|
{
|
|
|
|
MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
|
|
|
|
|
|
|
|
// check if player has changed cell, or count of the reference has become 0
|
|
|
|
if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL)
|
2013-04-21 19:24:48 +00:00
|
|
|
|| (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0))
|
2013-03-31 13:50:48 +00:00
|
|
|
{
|
2013-04-21 19:24:48 +00:00
|
|
|
if (!mPtr.isEmpty())
|
|
|
|
{
|
|
|
|
mPtr = MWWorld::Ptr();
|
|
|
|
onReferenceUnavailable();
|
|
|
|
}
|
2013-03-31 13:50:48 +00:00
|
|
|
}
|
2012-05-26 23:14:33 +00:00
|
|
|
|
|
|
|
mCurrentPlayerCell = playerCell;
|
|
|
|
}
|
|
|
|
}
|