1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-06 16:15:33 +00:00

removed setCrosshairOwned from windowmanager

This commit is contained in:
Jiří Kuneš 2015-07-17 19:13:45 +02:00
parent c019f8e23d
commit e68b388d16
5 changed files with 22 additions and 30 deletions

View file

@ -219,7 +219,6 @@ namespace MWBase
virtual void unsetSelectedWeapon() = 0;
virtual void showCrosshair(bool show) = 0;
virtual void setCrosshairOwned(bool owned) = 0;
virtual bool getSubtitlesEnabled() = 0;
virtual bool toggleGui() = 0;

View file

@ -300,8 +300,6 @@ namespace MWGui
mDynamicToolTipBox->setVisible(true);
}
checkOwned();
}
}
@ -351,27 +349,23 @@ namespace MWGui
return tooltipSize;
}
void ToolTips::checkOwned()
bool ToolTips::checkOwned()
{
if(Settings::Manager::getBool("show owned", "Game"))
// true=owned, false=notOwned
if(!mFocusObject.isEmpty())
{
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr victim;
if(!mFocusObject.isEmpty())
{
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr victim;
MWBase::MechanicsManager* mm = MWBase::Environment::get().getMechanicsManager();
bool allowed = mm->isAllowedToUse(ptr, cellref, victim); // 0 - owned, 1 - not owned
MWBase::MechanicsManager* mm = MWBase::Environment::get().getMechanicsManager();
bool allowed = mm->isAllowedToUse(ptr, cellref, victim);
wm->setCrosshairOwned(!allowed);
}
else
{
wm->setCrosshairOwned(false);
}
return !allowed;
}
else
{
return false;
}
}

View file

@ -87,6 +87,9 @@ namespace MWGui
static void createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace);
static void createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass);
static void createMagicEffectToolTip(MyGUI::Widget* widget, short id);
bool checkOwned();
/// Checks if object is owned and sets correct crosshair mode
private:
MyGUI::Widget* mDynamicToolTipBox;
@ -95,9 +98,6 @@ namespace MWGui
MyGUI::IntSize getToolTipViaPtr (bool image=true);
///< @return requested tooltip size
void checkOwned();
/// Checks if object is owned and sets correct crosshair mode
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
///< @return requested tooltip size

View file

@ -1038,6 +1038,12 @@ namespace MWGui
void WindowManager::setFocusObject(const MWWorld::Ptr& focus)
{
mToolTips->setFocusObject(focus);
if(Settings::Manager::getBool("show owned", "Game") && mHud)
{
bool owned = mToolTips->checkOwned();
mHud->setCrosshairOwned(owned);
}
}
void WindowManager::setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y)
@ -1423,12 +1429,6 @@ namespace MWGui
if (mHud)
mHud->setCrosshairVisible (show && mCrosshairEnabled);
}
void WindowManager::setCrosshairOwned (bool owned)
{
if (mHud)
mHud->setCrosshairOwned (owned);
}
void WindowManager::activateQuickKey (int index)
{

View file

@ -233,7 +233,6 @@ namespace MWGui
virtual void unsetSelectedWeapon();
virtual void showCrosshair(bool show);
virtual void setCrosshairOwned(bool owned);
virtual bool getSubtitlesEnabled();
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)