1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 15:10:03 +00:00

Fix activation not working sometimes

The current player cell was only being updated when the reference was not empty, causing it
to incorrectly detect a cell change the first time something was activated in a newly visited cell, immediately closing the opened dialogue again.
This commit is contained in:
scrawl 2013-04-21 21:24:48 +02:00
parent a8e3acd6c4
commit 8bf1149cec

View file

@ -18,18 +18,18 @@ namespace MWGui
void ReferenceInterface::checkReferenceAvailable() void ReferenceInterface::checkReferenceAvailable()
{ {
if (mPtr.isEmpty())
return;
MWWorld::Ptr::CellStore* playerCell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell(); 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 // check if player has changed cell, or count of the reference has become 0
if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL) if ((playerCell != mCurrentPlayerCell && mCurrentPlayerCell != NULL)
|| mPtr.getRefData().getCount() == 0) || (!mPtr.isEmpty() && mPtr.getRefData().getCount() == 0))
{
if (!mPtr.isEmpty())
{ {
mPtr = MWWorld::Ptr(); mPtr = MWWorld::Ptr();
onReferenceUnavailable(); onReferenceUnavailable();
} }
}
mCurrentPlayerCell = playerCell; mCurrentPlayerCell = playerCell;
} }