diff --git a/apps/openmw/mwworld/action.cpp b/apps/openmw/mwworld/action.cpp index 90e30a5bf..748f6aff7 100644 --- a/apps/openmw/mwworld/action.cpp +++ b/apps/openmw/mwworld/action.cpp @@ -6,9 +6,8 @@ #include "../mwbase/soundmanager.hpp" -MWWorld::Action::Action() { - teleport = false; -} +MWWorld::Action::Action (bool teleport) : mTeleport (teleport) +{} MWWorld::Action::~Action() {} @@ -16,17 +15,17 @@ void MWWorld::Action::execute (const Ptr& actor) { if (!mSoundId.empty()) { - if (teleport == true) - { - //this is a teleport action, so we need to call playSound - MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, - MWBase::SoundManager::Play_NoTrack); - } - else - { - MWBase::Environment::get().getSoundManager()->playSound3D (actor, mSoundId, 1.0, 1.0, - MWBase::SoundManager::Play_NoTrack); - } + if (mTeleport == true) + { + //this is a teleport action, so we need to call playSound + MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0, + MWBase::SoundManager::Play_NoTrack); + } + else + { + MWBase::Environment::get().getSoundManager()->playSound3D (actor, mSoundId, 1.0, 1.0, + MWBase::SoundManager::Play_NoTrack); + } } executeImp (actor); diff --git a/apps/openmw/mwworld/action.hpp b/apps/openmw/mwworld/action.hpp index 01180a778..511a7002d 100644 --- a/apps/openmw/mwworld/action.hpp +++ b/apps/openmw/mwworld/action.hpp @@ -11,6 +11,7 @@ namespace MWWorld class Action { std::string mSoundId; + bool mTeleport; // not implemented Action (const Action& action); @@ -18,12 +19,10 @@ namespace MWWorld virtual void executeImp (const Ptr& actor) = 0; - protected: - bool teleport; //True if the action will teleport the actor - public: - Action(); + Action (bool teleport = false); + ///< \param teleport action will teleport the actor virtual ~Action(); diff --git a/apps/openmw/mwworld/actionteleport.cpp b/apps/openmw/mwworld/actionteleport.cpp index e65873223..ae5ffc3b9 100644 --- a/apps/openmw/mwworld/actionteleport.cpp +++ b/apps/openmw/mwworld/actionteleport.cpp @@ -8,15 +8,12 @@ namespace MWWorld { ActionTeleport::ActionTeleport (const std::string& cellName, const ESM::Position& position) - : mCellName (cellName), mPosition (position) + : Action (true), mCellName (cellName), mPosition (position) { - teleport = true; } void ActionTeleport::executeImp (const Ptr& actor) { - teleport = true; - if (mCellName.empty()) MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition); else