Fix ReferenceInterface not resetting the Ptr after it was deleted, causing onReferenceUnavailable to be called every frame. Fix inputmanager hiding the cursor when it shouldn't.

This commit is contained in:
scrawl 2013-03-31 15:50:48 +02:00
parent 1a2daa3bc1
commit 8fd961bbac
2 changed files with 8 additions and 20 deletions

View file

@ -26,7 +26,10 @@ namespace MWGui
// 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.getRefData().getCount() == 0)
{
mPtr = MWWorld::Ptr();
onReferenceUnavailable(); onReferenceUnavailable();
}
mCurrentPlayerCell = playerCell; mCurrentPlayerCell = playerCell;
} }

View file

@ -372,26 +372,11 @@ namespace MWInput
void InputManager::changeInputMode(bool guiMode) void InputManager::changeInputMode(bool guiMode)
{ {
MWBase::Environment::get().getWindowManager()->setMouseVisible(guiMode); MWBase::Environment::get().getWindowManager()->setMouseVisible(guiMode);
if(guiMode) mGuiCursorEnabled = guiMode;
{ mMouseLookEnabled = !guiMode;
// Disable mouse look if (guiMode)
mMouseLookEnabled = false; mWindows.showCrosshair(false);
// if not in gui mode, the camera decides whether to show crosshair or not.
mWindows.showCrosshair (false);
// Enable GUI events
mGuiCursorEnabled = true;
}
else
{
// Enable mouse look
mMouseLookEnabled = true;
mWindows.showCrosshair (false);
// Disable GUI events
mGuiCursorEnabled = false;
}
} }
void InputManager::processChangedSettings(const Settings::CategorySettingVector& changed) void InputManager::processChangedSettings(const Settings::CategorySettingVector& changed)