From 4a6d80612729e58d0a8c6441e39035423194ac7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kune=C5=A1?= Date: Fri, 17 Jul 2015 20:30:00 +0200 Subject: [PATCH] fixed comment, save settings to member variable, removed usless include, changed variable to const --- apps/openmw/mwbase/mechanicsmanager.hpp | 3 +-- apps/openmw/mwgui/tooltips.cpp | 5 +---- apps/openmw/mwgui/tooltips.hpp | 4 ++-- apps/openmw/mwgui/windowmanagerimp.cpp | 5 ++++- apps/openmw/mwgui/windowmanagerimp.hpp | 2 ++ 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwbase/mechanicsmanager.hpp b/apps/openmw/mwbase/mechanicsmanager.hpp index 7889988e9..b66e60e1d 100644 --- a/apps/openmw/mwbase/mechanicsmanager.hpp +++ b/apps/openmw/mwbase/mechanicsmanager.hpp @@ -6,8 +6,6 @@ #include #include -#include "../mwworld/ptr.hpp" - namespace osg { class Vec3f; @@ -25,6 +23,7 @@ namespace MWWorld { class Ptr; class CellStore; + class CellRef; } namespace Loading diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 28ff47260..22d5d14f7 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -298,7 +298,6 @@ namespace MWGui tooltipSize.height); mDynamicToolTipBox->setVisible(true); - } } } @@ -343,7 +342,6 @@ namespace MWGui if (!image) info.icon = ""; tooltipSize = createToolTip(info); - } return tooltipSize; @@ -351,10 +349,9 @@ namespace MWGui bool ToolTips::checkOwned() { - // true=owned, false=notOwned if(!mFocusObject.isEmpty()) { - MWWorld::CellRef& cellref = mFocusObject.getCellRef(); + const MWWorld::CellRef& cellref = mFocusObject.getCellRef(); MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr(); MWWorld::Ptr victim; diff --git a/apps/openmw/mwgui/tooltips.hpp b/apps/openmw/mwgui/tooltips.hpp index 26a4fe2c7..bd4a81c32 100644 --- a/apps/openmw/mwgui/tooltips.hpp +++ b/apps/openmw/mwgui/tooltips.hpp @@ -89,8 +89,8 @@ namespace MWGui static void createMagicEffectToolTip(MyGUI::Widget* widget, short id); bool checkOwned(); - /// Checks if object is owned and sets correct crosshair mode - + /// Returns True if taking mFocusObject would be crime + private: MyGUI::Widget* mDynamicToolTipBox; diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 2f8cfbf62..cb5d4442f 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -187,6 +187,7 @@ namespace MWGui , mRestAllowed(true) , mFPS(0.0f) , mFallbackMap(fallbackMap) + , mShowOwned(false) { float uiScale = Settings::Manager::getFloat("scaling factor", "GUI"); mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager(), uiScale); @@ -261,6 +262,8 @@ namespace MWGui MyGUI::ClipboardManager::getInstance().eventClipboardChanged += MyGUI::newDelegate(this, &WindowManager::onClipboardChanged); MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested); + + mShowOwned = Settings::Manager::getBool("show owned", "Game"); } void WindowManager::initUI() @@ -1039,7 +1042,7 @@ namespace MWGui { mToolTips->setFocusObject(focus); - if(Settings::Manager::getBool("show owned", "Game") && mHud) + if(mShowOwned && mHud) { bool owned = mToolTips->checkOwned(); mHud->setCrosshairOwned(owned); diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index e6c8d0a81..5c4b2d447 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -486,6 +486,8 @@ namespace MWGui float mFPS; std::map mFallbackMap; + + bool mShowOwned; /** * Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property.