1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

Merge remote-tracking branch 'trombonecot/master'

Conflicts:
	apps/openmw/mwclass/light.cpp
This commit is contained in:
Marc Zinnschlag 2012-11-19 21:21:00 +01:00
commit 5d45bcd03a
6 changed files with 52 additions and 10 deletions

View file

@ -50,7 +50,7 @@ add_openmw_dir (mwsound
add_openmw_dir (mwworld
refdata worldimp physicssystem scene globals class action nullaction actionteleport
containerstore actiontalk actiontake manualref player cellfunctors
containerstore actiontalk actiontake manualref player cellfunctors failedaction
cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp actionalchemy cellstore actionapply actioneat
esmstore store recordcmp

View file

@ -8,7 +8,7 @@
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/customdata.hpp"
#include "../mwworld/cellstore.hpp"
@ -129,7 +129,7 @@ namespace MWClass
{
// Trap activation goes here
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(trapActivationSound);
ptr.getCellRef().mTrap = "";
return action;
@ -137,7 +137,7 @@ namespace MWClass
}
else
{
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(lockedSound);
return action;
}

View file

@ -10,6 +10,7 @@
#include "../mwworld/player.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/actionteleport.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
@ -110,8 +111,7 @@ namespace MWClass
// Trap activation
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(trapActivationSound);
ptr.getCellRef().mTrap = "";
@ -133,7 +133,7 @@ namespace MWClass
else
{
// another NPC or a creature is using the door
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
}
}
else
@ -152,7 +152,7 @@ namespace MWClass
else
{
// locked, and we can't open.
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(lockedSound);
return action;
}

View file

@ -12,6 +12,7 @@
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
@ -91,7 +92,7 @@ namespace MWClass
ptr.get<ESM::Light>();
if (!(ref->mBase->mData.mFlags & ESM::Light::Carry))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));

View file

@ -0,0 +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)
{ }
void FailedAction::executeImp (const Ptr& actor)
{
if ( actor.getRefData().getHandle()=="player" and !(message.empty()))
{
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
}
}
}

View file

@ -0,0 +1,20 @@
#ifndef GAME_MWWORLD_FAILEDACTION_H
#define GAME_MWWORLD_FAILEDACTION_H
#include "action.hpp"
#include "ptr.hpp"
namespace MWWorld
{
class FailedAction : public Action
{
std::string message;
virtual void executeImp (const Ptr& actor);
public:
FailedAction (const std::string& message = std::string());
};
}
#endif