2012-05-27 01:14:33 +02:00
|
|
|
#include "referenceinterface.hpp"
|
|
|
|
|
2012-07-03 12:30:50 +02:00
|
|
|
#include "../mwbase/world.hpp"
|
2012-05-27 01:14:33 +02:00
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
2012-05-27 01:14:33 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
ReferenceInterface::ReferenceInterface()
|
|
|
|
: mCurrentPlayerCell(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-07 01:14:18 +02:00
|
|
|
ReferenceInterface::~ReferenceInterface()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-05-27 01:14:33 +02:00
|
|
|
void ReferenceInterface::checkReferenceAvailable()
|
|
|
|
{
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::CellStore* playerCell = MWMechanics::getPlayer().getCell();
|
2012-05-27 01:14:33 +02:00
|
|
|
|
2017-08-12 09:36:09 +04:00
|
|
|
// check if count of the reference has become 0
|
|
|
|
if (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0)
|
2013-03-31 15:50:48 +02:00
|
|
|
{
|
2013-04-21 21:24:48 +02:00
|
|
|
if (!mPtr.isEmpty())
|
|
|
|
{
|
|
|
|
mPtr = MWWorld::Ptr();
|
|
|
|
onReferenceUnavailable();
|
|
|
|
}
|
2013-03-31 15:50:48 +02:00
|
|
|
}
|
2012-05-27 01:14:33 +02:00
|
|
|
|
|
|
|
mCurrentPlayerCell = playerCell;
|
|
|
|
}
|
|
|
|
}
|