2013-03-23 08:16:46 +01:00
|
|
|
#include "actionrepair.hpp"
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2014-04-24 22:47:45 -04:00
|
|
|
#include "../mwbase/world.hpp"
|
2015-09-10 18:48:34 +12:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
2013-03-23 08:16:46 +01:00
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
2018-07-09 19:31:40 +04:00
|
|
|
ActionRepair::ActionRepair(const Ptr& item, bool force)
|
|
|
|
: Action (false, item)
|
|
|
|
, mForce(force)
|
2013-03-23 08:16:46 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActionRepair::executeImp (const Ptr& actor)
|
|
|
|
{
|
2015-09-10 18:48:34 +12:00
|
|
|
if (actor != MWMechanics::getPlayer())
|
2015-09-07 22:13:20 +02:00
|
|
|
return;
|
|
|
|
|
2018-07-09 19:31:40 +04:00
|
|
|
if(!mForce && MWMechanics::isPlayerInCombat())
|
|
|
|
{
|
2014-04-24 22:47:45 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage2}");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-09-22 21:26:41 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Repair, getTarget());
|
2013-03-23 08:16:46 +01:00
|
|
|
}
|
|
|
|
}
|