mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
33 lines
870 B
C++
33 lines
870 B
C++
#include "actionopen.hpp"
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
|
#include "../mwbase/windowmanager.hpp"
|
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
#include "../mwmechanics/disease.hpp"
|
|
|
|
namespace MWWorld
|
|
{
|
|
ActionOpen::ActionOpen(const MWWorld::Ptr& container)
|
|
: Action(false, container)
|
|
{
|
|
}
|
|
|
|
void ActionOpen::executeImp(const MWWorld::Ptr& actor)
|
|
{
|
|
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
|
|
return;
|
|
|
|
if (actor != MWMechanics::getPlayer())
|
|
return;
|
|
|
|
if (!MWBase::Environment::get().getMechanicsManager()->onOpen(getTarget()))
|
|
return;
|
|
|
|
MWMechanics::diseaseContact(actor, getTarget());
|
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container, getTarget());
|
|
}
|
|
}
|