mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 22:15:33 +00:00
Failed action
This commit is contained in:
parent
82ea547ce4
commit
4e4d15f8ac
5 changed files with 14 additions and 18 deletions
|
@ -130,7 +130,7 @@ namespace MWClass
|
|||
{
|
||||
// Trap activation goes here
|
||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||
action->setSound(trapActivationSound);
|
||||
ptr.getCellRef().mTrap = "";
|
||||
return action;
|
||||
|
@ -138,7 +138,7 @@ namespace MWClass
|
|||
}
|
||||
else
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||
action->setSound(lockedSound);
|
||||
return action;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace MWClass
|
|||
// Trap activation
|
||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||
action->setSound(trapActivationSound);
|
||||
ptr.getCellRef().mTrap = "";
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace MWClass
|
|||
else
|
||||
{
|
||||
// another NPC or a creature is using the door
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction());
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -153,7 +153,7 @@ namespace MWClass
|
|||
else
|
||||
{
|
||||
// locked, and we can't open.
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||
action->setSound(lockedSound);
|
||||
return action;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace MWClass
|
|||
ptr.get<ESM::Light>();
|
||||
|
||||
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction());
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
#include "failedaction.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
FailedAction::FailedAction (const std::string& msg) : Action (false)
|
||||
{
|
||||
message = msg;
|
||||
}
|
||||
FailedAction::FailedAction (const std::string& msg) : Action (false), message(msg)
|
||||
{ }
|
||||
|
||||
FailedAction::FailedAction () : Action (false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FailedAction::executeImp (const Ptr& actor)
|
||||
{
|
||||
if ( actor.getRefData().getHandle()=="player" and not(message.empty()))
|
||||
if ( actor.getRefData().getHandle()=="player" and !(message.empty()))
|
||||
{
|
||||
//return a message here
|
||||
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ namespace MWWorld
|
|||
virtual void executeImp (const Ptr& actor);
|
||||
|
||||
public:
|
||||
FailedAction (const std::string& message);
|
||||
FailedAction ();
|
||||
FailedAction (const std::string& message = std::string());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue