forked from mirror/openmw-tes3mp
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
|
// Trap activation goes here
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
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);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
return action;
|
return action;
|
||||||
|
@ -138,7 +138,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction());
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace MWClass
|
||||||
// Trap activation
|
// Trap activation
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
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);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// another NPC or a creature is using the door
|
// 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
|
else
|
||||||
|
@ -153,7 +153,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// locked, and we can't open.
|
// 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);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace MWClass
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
|
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));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
#include "failedaction.hpp"
|
#include "failedaction.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
FailedAction::FailedAction (const std::string& msg) : Action (false)
|
FailedAction::FailedAction (const std::string& msg) : Action (false), message(msg)
|
||||||
{
|
{ }
|
||||||
message = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
FailedAction::FailedAction () : Action (false)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void FailedAction::executeImp (const Ptr& actor)
|
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);
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FailedAction (const std::string& message);
|
FailedAction (const std::string& message = std::string());
|
||||||
FailedAction ();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue