mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
disable cusor when item/container is owned
This commit is contained in:
parent
355ef14d23
commit
72728b9c01
@ -17,6 +17,7 @@
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwmechanics/spellcasting.hpp"
|
||||
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
#include "mapwindow.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
@ -342,6 +343,27 @@ namespace MWGui
|
||||
if (!image)
|
||||
info.icon = "";
|
||||
tooltipSize = createToolTip(info);
|
||||
|
||||
// start owned check
|
||||
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
MWWorld::Ptr victim;
|
||||
|
||||
MWMechanics::MechanicsManager* mm = new MWMechanics::MechanicsManager;
|
||||
bool allowed = mm->isAllowedToUse(ptr, cellref, victim); // 0 - owned, 1 - not owned
|
||||
|
||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||
if(allowed)
|
||||
{
|
||||
// if 'item' is not owned
|
||||
wm->showCrosshair(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if 'item' is owned
|
||||
wm->showCrosshair(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return tooltipSize;
|
||||
|
@ -175,13 +175,15 @@ namespace MWMechanics
|
||||
|
||||
/// Has the player stolen this item from the given owner?
|
||||
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid);
|
||||
|
||||
/// @return is \a ptr allowed to take/use \a cellref or is it a crime?
|
||||
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim);
|
||||
|
||||
private:
|
||||
void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
|
||||
OffenseType type, int arg=0);
|
||||
|
||||
/// @return is \a ptr allowed to take/use \a cellref or is it a crime?
|
||||
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user