@ -12,6 +12,7 @@
#include "../mwworld/actionalchemy.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
@ -61,6 +62,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
boost::shared_ptr<MWWorld::Action> action(
new MWWorld::ActionTake (ptr));
@ -15,6 +15,7 @@
#include "../mwworld/inventorystore.hpp"
@ -64,6 +65,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
action->setSound(getUpSoundId(ptr));
@ -13,6 +13,7 @@
#include "../mwgui/tooltips.hpp"
@ -62,6 +63,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
@ -9,6 +9,7 @@
#include "../mwworld/ptr.hpp"
#include "../mwworld/failedaction.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/customdata.hpp"
@ -85,6 +86,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
const std::string lockedSound = "LockedChest";
const std::string trapActivationSound = "Disarm Trap Fail";
#include "../mwworld/actioneat.hpp"
#include "../mwworld/player.hpp"
#include "../mwmechanics/npcstats.hpp"
@ -72,6 +73,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
@ -88,6 +88,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
@ -14,6 +14,7 @@
#include "../mwworld/manualref.hpp"
@ -65,6 +66,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
@ -11,6 +11,7 @@
#include "../mwworld/actiontake.hpp"
@ -60,6 +61,9 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
@ -14,8 +14,10 @@
using namespace MWGui;
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_book.layout", parWindowManager)
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_book.layout", parWindowManager)
, mTakeButtonShow(true)
, mTakeButtonAllowed(true)
getWidget(mCloseButton, "CloseButton");
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
@ -85,7 +87,14 @@ void BookWindow::open (MWWorld::Ptr book)
void BookWindow::setTakeButtonShow(bool show)
mTakeButton->setVisible(show);
mTakeButtonShow = show;
mTakeButton->setVisible(mTakeButtonShow && mTakeButtonAllowed);
}
void BookWindow::setInventoryAllowed(bool allowed)
mTakeButtonAllowed = allowed;
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
@ -17,6 +17,8 @@ namespace MWGui
void open(MWWorld::Ptr book);
void setTakeButtonShow(bool show);
void setInventoryAllowed(bool allowed);
protected:
void onNextPageButtonClicked (MyGUI::Widget* sender);
void onPrevPageButtonClicked (MyGUI::Widget* sender);
@ -40,6 +42,9 @@ namespace MWGui
std::vector<MyGUI::Widget*> mPages;
MWWorld::Ptr mBook;
bool mTakeButtonShow;
bool mTakeButtonAllowed;
};
@ -12,8 +12,10 @@
ScrollWindow::ScrollWindow (MWBase::WindowManager& parWindowManager) :
WindowBase("openmw_scroll.layout", parWindowManager)
ScrollWindow::ScrollWindow (MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_scroll.layout", parWindowManager)
getWidget(mTextView, "TextView");
@ -50,7 +52,14 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
void ScrollWindow::setTakeButtonShow(bool show)
void ScrollWindow::setInventoryAllowed(bool allowed)
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
@ -15,6 +15,7 @@ namespace MWGui
void open (MWWorld::Ptr scroll);
void onCloseButtonClicked (MyGUI::Widget* _sender);
@ -26,6 +27,10 @@ namespace MWGui
MyGUI::ScrollView* mTextView;
MWWorld::Ptr mScroll;
@ -109,7 +109,6 @@ WindowManager::WindowManager(
, mHudEnabled(true)
, mTranslationDataStorage (translationDataStorage)
// Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath);
mGui = mGuiManager->getGui();
@ -196,6 +195,9 @@ WindowManager::WindowManager(
unsetSelectedSpell();
unsetSelectedWeapon();
if (newGame)
disallowAll ();
// Set up visibility
updateVisible();
@ -943,12 +945,23 @@ bool WindowManager::isAllowed (GuiWindow wnd) const
void WindowManager::allow (GuiWindow wnd)
mAllowed = (GuiWindow)(mAllowed | wnd);
if (wnd & GW_Inventory)
mBookWindow->setInventoryAllowed (true);
mScrollWindow->setInventoryAllowed (true);
void WindowManager::disallowAll()
mAllowed = GW_None;
mBookWindow->setInventoryAllowed (false);
mScrollWindow->setInventoryAllowed (false);
@ -18,7 +18,7 @@ MWWorld::Action::~Action() {}
void MWWorld::Action::execute (const Ptr& actor)
if (!mSoundId.empty() & executeImp (actor))
if (!mSoundId.empty())
if (mKeepSound && actor.getRefData().getHandle()=="player")
@ -35,6 +35,8 @@ void MWWorld::Action::execute (const Ptr& actor)
mKeepSound ? MWBase::SoundManager::Play_NoTrack : MWBase::SoundManager::Play_Normal);
executeImp (actor);
void MWWorld::Action::setSound (const std::string& id)
@ -18,8 +18,7 @@ namespace MWWorld
Action (const Action& action);
Action& operator= (const Action& action);
/// @return true if the sound should be played, false if not (e.g. if the action is not allowed)
virtual bool executeImp (const Ptr& actor) = 0;
virtual void executeImp (const Ptr& actor) = 0;
@ -5,9 +5,8 @@
namespace MWWorld
bool ActionAlchemy::executeImp (const Ptr& actor)
void ActionAlchemy::executeImp (const Ptr& actor)
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Alchemy);
return true;
@ -7,7 +7,7 @@ namespace MWWorld
class ActionAlchemy : public Action
virtual bool executeImp (const Ptr& actor);
virtual void executeImp (const Ptr& actor);
@ -9,10 +9,9 @@ namespace MWWorld
: Action (false, target), mId (id)
{}
bool ActionApply::executeImp (const Ptr& actor)
void ActionApply::executeImp (const Ptr& actor)
MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor);
@ -21,10 +20,9 @@ namespace MWWorld
: Action (false, target), mId (id), mSkillIndex (skillIndex), mUsageType (usageType)
bool ActionApplyWithSkill::executeImp (const Ptr& actor)
void ActionApplyWithSkill::executeImp (const Ptr& actor)
if (MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor) && mUsageType!=-1)
MWWorld::Class::get (getTarget()).skillUsageSucceeded (actor, mSkillIndex, mUsageType);
@ -13,7 +13,7 @@ namespace MWWorld
std::string mId;
public:
@ -26,7 +26,7 @@ namespace MWWorld
int mSkillIndex;
int mUsageType;
@ -16,7 +16,7 @@
bool ActionEat::executeImp (const Ptr& actor)
void ActionEat::executeImp (const Ptr& actor)
// remove used item
getTarget().getRefData().setCount (getTarget().getRefData().getCount()-1);
@ -42,8 +42,6 @@ namespace MWWorld
// increase skill
Class::get (actor).skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}
@ -8,7 +8,7 @@ namespace MWWorld
class ActionEat : public Action
@ -16,7 +16,7 @@ namespace MWWorld
bool ActionEquip::executeImp (const Ptr& actor)
void ActionEquip::executeImp (const Ptr& actor)
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
@ -113,7 +113,5 @@ namespace MWWorld
/* Set OnPCEquip Variable on item's script, if the player is equipping it, and it has a script with that variable declared */
if(equipped && actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() && script != "")
(*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 1);
class ActionEquip : public Action
/// @param item to equip
@ -14,13 +14,12 @@ namespace MWWorld
bool ActionOpen::executeImp (const MWWorld::Ptr& actor)
void ActionOpen::executeImp (const MWWorld::Ptr& actor)
return false;
return;
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container);
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(getTarget());
@ -10,7 +10,7 @@ namespace MWWorld
class ActionOpen : public Action
virtual bool executeImp (const MWWorld::Ptr& actor);
virtual void executeImp (const MWWorld::Ptr& actor);
ActionOpen (const Ptr& container);
@ -19,7 +19,7 @@ namespace MWWorld
bool ActionRead::executeImp (const MWWorld::Ptr& actor)
void ActionRead::executeImp (const MWWorld::Ptr& actor)
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
@ -53,6 +53,5 @@ namespace MWWorld
npcStats.flagAsUsed (ref->mBase->mId);
class ActionRead : public Action
/// @param book or scroll to read
@ -12,18 +12,13 @@ namespace MWWorld
ActionTake::ActionTake (const MWWorld::Ptr& object) : Action (true, object) {}
bool ActionTake::executeImp (const Ptr& actor)
void ActionTake::executeImp (const Ptr& actor)
// insert into player's inventory
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
MWWorld::Class::get (player).getContainerStore (player).add (getTarget());
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
class ActionTake : public Action
@ -3,15 +3,13 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/inputmanager.hpp"
ActionTalk::ActionTalk (const Ptr& actor) : Action (false, actor) {}
bool ActionTalk::executeImp (const Ptr& actor)
void ActionTalk::executeImp (const Ptr& actor)
MWBase::Environment::get().getDialogueManager()->startDialogue (getTarget());
class ActionTalk : public Action
@ -12,12 +12,11 @@ namespace MWWorld
bool ActionTeleport::executeImp (const Ptr& actor)
void ActionTeleport::executeImp (const Ptr& actor)
if (mCellName.empty())
MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition);
else
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, mPosition);
@ -14,7 +14,7 @@ namespace MWWorld
std::string mCellName;
ESM::Position mPosition;
@ -11,12 +11,11 @@ namespace MWWorld
{ }
bool FailedAction::executeImp (const Ptr& actor)
void FailedAction::executeImp (const Ptr& actor)
if ( actor.getRefData().getHandle()=="player" && !(message.empty()))
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
@ -10,11 +10,11 @@ namespace MWWorld
std::string message;
FailedAction (const std::string& message = std::string());
#endif
/// \brief Action: do nothing
class NullAction : public Action
virtual bool executeImp (const Ptr& actor) {return false;}
virtual void executeImp (const Ptr& actor) {}