Improve WindowManager API with a generic way of passing a Ptr to the opened GUI window

new-script-api
scrawl 7 years ago
parent 3820416277
commit 84657271c7

@ -115,6 +115,7 @@ namespace MWBase
virtual void setNewGame(bool newgame) = 0;
virtual void pushGuiMode (MWGui::GuiMode mode, const MWWorld::Ptr& arg) = 0;
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
virtual void popGuiMode() = 0;
@ -157,8 +158,6 @@ namespace MWBase
virtual void updateSpellWindow() = 0;
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object) = 0;
/// Set value for the given ID.
virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value) = 0;
virtual void setValue (int parSkill, const MWMechanics::SkillValue& value) = 0;
@ -284,21 +283,6 @@ namespace MWBase
virtual bool getPlayerSleeping() = 0;
virtual void wakeUpPlayer() = 0;
virtual void showCompanionWindow(MWWorld::Ptr actor) = 0;
virtual void startSpellMaking(MWWorld::Ptr actor) = 0;
virtual void startEnchanting(MWWorld::Ptr actor) = 0;
virtual void startRecharge(MWWorld::Ptr soulgem) = 0;
virtual void startSelfEnchanting(MWWorld::Ptr soulgem) = 0;
virtual void startTraining(MWWorld::Ptr actor) = 0;
virtual void startRepair(MWWorld::Ptr actor) = 0;
virtual void startRepairItem(MWWorld::Ptr item) = 0;
virtual void startTravel(const MWWorld::Ptr& actor) = 0;
virtual void startSpellBuying(const MWWorld::Ptr& actor) = 0;
virtual void startTrade(const MWWorld::Ptr& actor) = 0;
virtual void openContainer(const MWWorld::Ptr& container, bool loot) = 0;
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton) = 0;
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton) = 0;
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
virtual void changePointer (const std::string& name) = 0;

@ -457,11 +457,11 @@ namespace MWClass
// by default user can loot friendly actors during death animation
if (canLoot && !stats.getAiSequence().isInCombat())
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
// otherwise wait until death animation
if(stats.isDeathAnimationFinished())
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
// death animation is not finished, do nothing
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));

@ -872,11 +872,11 @@ namespace MWClass
// by default user can loot friendly actors during death animation
if (canLoot && !stats.getAiSequence().isInCombat())
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
// otherwise wait until death animation
if(stats.isDeathAnimationFinished())
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr));
// death animation is not finished, do nothing
return std::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction(""));

@ -186,7 +186,7 @@ namespace MWDialogue
bool isCompanion = !mActor.getClass().getScript(mActor).empty()
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
if (isCompanion)
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Companion, mActor);
}
bool DialogueManager::compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor)

@ -11,6 +11,7 @@
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/class.hpp"
#include "formatting.hpp"
@ -74,10 +75,13 @@ namespace MWGui
mPages.clear();
}
void BookWindow::openBook (MWWorld::Ptr book, bool showTakeButton)
void BookWindow::setPtr (const MWWorld::Ptr& book)
{
mBook = book;
MWWorld::Ptr player = MWMechanics::getPlayer();
bool showTakeButton = book.getContainerStore() != &player.getClass().getContainerStore(player);
clearPages();
mCurrentPage = 0;

@ -16,7 +16,7 @@ namespace MWGui
virtual void exit();
void openBook(MWWorld::Ptr book, bool showTakeButton);
void setPtr(const MWWorld::Ptr& book);
void setInventoryAllowed(bool allowed);
protected:

@ -103,7 +103,7 @@ void CompanionWindow::onBackgroundSelected()
}
}
void CompanionWindow::openCompanion(const MWWorld::Ptr& npc)
void CompanionWindow::setPtr(const MWWorld::Ptr& npc)
{
mPtr = npc;
updateEncumbranceBar();

@ -22,7 +22,7 @@ namespace MWGui
virtual void resetReference();
void openCompanion(const MWWorld::Ptr& npc);
void setPtr(const MWWorld::Ptr& npc);
void onFrame ();
private:

@ -422,7 +422,7 @@ namespace MWGui
setCoord(10,10, width-10, height/2);
}
void Console::setSelectedObject(const MWWorld::Ptr& object)
void Console::setPtr(const MWWorld::Ptr& object)
{
if (!object.isEmpty())
{
@ -448,12 +448,12 @@ namespace MWGui
void Console::onReferenceUnavailable()
{
setSelectedObject(MWWorld::Ptr());
setPtr(MWWorld::Ptr());
}
void Console::resetReference()
{
ReferenceInterface::resetReference();
setSelectedObject(MWWorld::Ptr());
setPtr(MWWorld::Ptr());
}
}

@ -25,7 +25,7 @@ namespace MWGui
{
public:
/// Set the implicit object for script execution
void setSelectedObject(const MWWorld::Ptr& object);
void setPtr(const MWWorld::Ptr& object);
MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory;

@ -129,11 +129,13 @@ namespace MWGui
dropItem();
}
void ContainerWindow::openContainer(const MWWorld::Ptr& container, bool loot)
void ContainerWindow::setPtr(const MWWorld::Ptr& container)
{
mPickpocketDetected = false;
mPtr = container;
bool loot = mPtr.getClass().isActor() && mPtr.getClass().getCreatureStats(mPtr).isDead();
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && !loot)
{
// we are stealing stuff

@ -33,7 +33,7 @@ namespace MWGui
public:
ContainerWindow(DragAndDrop* dragAndDrop);
void openContainer(const MWWorld::Ptr& container, bool loot=false);
void setPtr(const MWWorld::Ptr& container);
virtual void onClose();
virtual void resetReference();

@ -336,23 +336,23 @@ namespace MWGui
if (topic == gmst.find("sPersuasion")->getString())
mPersuasionDialog.setVisible(true);
else if (topic == gmst.find("sCompanionShare")->getString())
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion, mPtr);
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
{
if (topic == gmst.find("sBarter")->getString())
MWBase::Environment::get().getWindowManager()->startTrade(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter, mPtr);
else if (topic == gmst.find("sSpells")->getString())
MWBase::Environment::get().getWindowManager()->startSpellBuying(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying, mPtr);
else if (topic == gmst.find("sTravel")->getString())
MWBase::Environment::get().getWindowManager()->startTravel(mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel, mPtr);
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation, mPtr);
else if (topic == gmst.find("sEnchanting")->getString())
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting, mPtr);
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training, mPtr);
else if (topic == gmst.find("sRepair")->getString())
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair, mPtr);
}
}
}

@ -143,51 +143,36 @@ namespace MWGui
}
}
void EnchantingDialog::startEnchanting (MWWorld::Ptr actor)
void EnchantingDialog::setPtr (const MWWorld::Ptr& ptr)
{
mName->setCaption("");
mEnchanting.setSelfEnchanting(false);
mEnchanting.setEnchanter(actor);
mBuyButton->setCaptionWithReplacing("#{sBuy}");
mChanceLayout->setVisible(false);
mPtr = actor;
if (ptr.getClass().isActor())
{
mEnchanting.setSelfEnchanting(false);
mEnchanting.setEnchanter(ptr);
mBuyButton->setCaptionWithReplacing("#{sBuy}");
mChanceLayout->setVisible(false);
mPtr = ptr;
setSoulGem(MWWorld::Ptr());
mPrice->setVisible(true);
mPriceText->setVisible(true);
}
else
{
mEnchanting.setSelfEnchanting(true);
mEnchanting.setEnchanter(MWMechanics::getPlayer());
mBuyButton->setCaptionWithReplacing("#{sCreate}");
bool enabled = Settings::Manager::getBool("show enchant chance","Game");
mChanceLayout->setVisible(enabled);
mPtr = MWMechanics::getPlayer();
setSoulGem(ptr);
mPrice->setVisible(false);
mPriceText->setVisible(false);
}
setSoulGem(MWWorld::Ptr());
setItem(MWWorld::Ptr());
startEditing ();
mPrice->setVisible(true);
mPriceText->setVisible(true);
updateLabels();
}
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
{
mName->setCaption("");
MWWorld::Ptr player = MWMechanics::getPlayer();
mEnchanting.setSelfEnchanting(true);
mEnchanting.setEnchanter(player);
mBuyButton->setCaptionWithReplacing("#{sCreate}");
bool enabled = Settings::Manager::getBool("show enchant chance","Game");
mChanceLayout->setVisible(enabled);
mPtr = player;
startEditing();
setSoulGem(soulgem);
setItem(MWWorld::Ptr());
mPrice->setVisible(false);
mPriceText->setVisible(false);
updateLabels();
}

@ -26,8 +26,9 @@ namespace MWGui
void setSoulGem (const MWWorld::Ptr& gem);
void setItem (const MWWorld::Ptr& item);
void startEnchanting(MWWorld::Ptr actor);
void startSelfEnchanting(MWWorld::Ptr soulgem);
/// Actor Ptr: buy enchantment from this actor
/// Soulgem Ptr: player self-enchant
void setPtr(const MWWorld::Ptr& ptr);
virtual void resetReference();

@ -260,7 +260,7 @@ namespace MWGui
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
if (mode == GM_Console)
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Console, object);
else if ((mode == GM_Container) || (mode == GM_Inventory))
{
// pick up object

@ -32,7 +32,7 @@ MerchantRepair::MerchantRepair()
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onOkButtonClick);
}
void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
void MerchantRepair::setPtr(const MWWorld::Ptr &actor)
{
mActor = actor;
@ -145,7 +145,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
MWMechanics::CreatureStats& actorStats = mActor.getClass().getCreatureStats(mActor);
actorStats.setGoldPool(actorStats.getGoldPool() + price);
startRepair(mActor);
setPtr(mActor);
}
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)

@ -16,7 +16,7 @@ public:
virtual void exit();
void startRepair(const MWWorld::Ptr& actor);
void setPtr(const MWWorld::Ptr& actor);
private:
MyGUI::ScrollView* mList;

@ -67,7 +67,7 @@ void Recharge::exit()
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
}
void Recharge::start (const MWWorld::Ptr &item)
void Recharge::setPtr (const MWWorld::Ptr &item)
{
mGemIcon->setItem(item);
mGemIcon->setUserString("ToolTipType", "ItemPtr");

@ -26,7 +26,7 @@ public:
virtual void exit();
void start (const MWWorld::Ptr& gem);
void setPtr (const MWWorld::Ptr& gem);
protected:
ItemChargeView* mBox;

@ -63,7 +63,7 @@ void Repair::exit()
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
}
void Repair::startRepairItem(const MWWorld::Ptr &item)
void Repair::setPtr(const MWWorld::Ptr &item)
{
MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");

@ -23,7 +23,7 @@ public:
virtual void exit();
void startRepairItem (const MWWorld::Ptr& item);
void setPtr (const MWWorld::Ptr& item);
protected:
ItemChargeView* mRepairBox;

@ -12,6 +12,7 @@
#include "../mwmechanics/actorutil.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/class.hpp"
#include "formatting.hpp"
@ -49,13 +50,16 @@ namespace MWGui
center();
}
void ScrollWindow::openScroll (MWWorld::Ptr scroll, bool showTakeButton)
void ScrollWindow::setPtr (const MWWorld::Ptr& scroll)
{
// no 3d sounds because the object could be in a container.
MWBase::Environment::get().getWindowManager()->playSound("scroll");
mScroll = scroll;
MWWorld::Ptr player = MWMechanics::getPlayer();
bool showTakeButton = scroll.getContainerStore() != &player.getClass().getContainerStore(player);
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
Formatting::BookFormatter formatter;

@ -17,7 +17,7 @@ namespace MWGui
public:
ScrollWindow ();
void openScroll (MWWorld::Ptr scroll, bool showTakeButton);
void setPtr (const MWWorld::Ptr& scroll);
virtual void exit();
void setInventoryAllowed(bool allowed);

@ -22,13 +22,11 @@ namespace MWGui
{
if (button == 0)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Recharge);
MWBase::Environment::get().getWindowManager()->startRecharge(mSoulgem);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Recharge, mSoulgem);
}
else
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
MWBase::Environment::get().getWindowManager()->startSelfEnchanting(mSoulgem);
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting, mSoulgem);
}
}

@ -88,7 +88,12 @@ namespace MWGui
mSpellsWidgetMap.clear();
}
void SpellBuyingWindow::startSpellBuying(const MWWorld::Ptr& actor, int startOffset)
void SpellBuyingWindow::setPtr(const MWWorld::Ptr &actor)
{
setPtr(actor, 0);
}
void SpellBuyingWindow::setPtr(const MWWorld::Ptr& actor, int startOffset)
{
center();
mPtr = actor;
@ -161,7 +166,7 @@ namespace MWGui
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
npcStats.setGoldPool(npcStats.getGoldPool() + price);
startSpellBuying(mPtr, mSpellsView->getViewOffset().top);
setPtr(mPtr, mSpellsView->getViewOffset().top);
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
}

@ -25,7 +25,8 @@ namespace MWGui
public:
SpellBuyingWindow();
void startSpellBuying(const MWWorld::Ptr& actor, int startOffset);
void setPtr(const MWWorld::Ptr& actor);
void setPtr(const MWWorld::Ptr& actor, int startOffset);
virtual void exit();

@ -352,7 +352,7 @@ namespace MWGui
setWidgets(mAvailableEffectsList, mUsedEffectsView);
}
void SpellCreationDialog::startSpellMaking (MWWorld::Ptr actor)
void SpellCreationDialog::setPtr (const MWWorld::Ptr& actor)
{
mPtr = actor;
mNameEdit->setCaption("");

@ -153,7 +153,7 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
void startSpellMaking(MWWorld::Ptr actor);
void setPtr(const MWWorld::Ptr& actor);
protected:
virtual void onReferenceUnavailable ();

@ -115,7 +115,7 @@ namespace MWGui
}
}
void TradeWindow::startTrade(const MWWorld::Ptr& actor)
void TradeWindow::setPtr(const MWWorld::Ptr& actor)
{
mPtr = actor;

@ -27,7 +27,7 @@ namespace MWGui
public:
TradeWindow();
void startTrade(const MWWorld::Ptr& actor);
void setPtr(const MWWorld::Ptr& actor);
void borrowItem (int index, size_t count);
void returnItem (int index, size_t count);

@ -65,7 +65,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
}
void TrainingWindow::startTraining (MWWorld::Ptr actor)
void TrainingWindow::setPtr (const MWWorld::Ptr& actor)
{
mPtr = actor;

@ -18,7 +18,7 @@ namespace MWGui
virtual void exit();
void startTraining(MWWorld::Ptr actor);
void setPtr(const MWWorld::Ptr& actor);
void onFrame(float dt);

@ -108,7 +108,7 @@ namespace MWGui
MyGUI::Gui::getInstance().destroyWidget(mDestinationsView->getChildAt(0));
}
void TravelWindow::startTravel(const MWWorld::Ptr& actor)
void TravelWindow::setPtr(const MWWorld::Ptr& actor)
{
center();
mPtr = actor;

@ -26,7 +26,7 @@ namespace MWGui
virtual void exit();
void startTravel(const MWWorld::Ptr& actor);
void setPtr (const MWWorld::Ptr& actor);
protected:
MyGUI::Button* mCancelButton;

@ -8,6 +8,11 @@ namespace MWBase
class WindowManager;
}
namespace MWWorld
{
class Ptr;
}
namespace MWGui
{
class WindowManager;
@ -21,6 +26,9 @@ namespace MWGui
// Events
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
/// Open this object in the GUI, for windows that support it
virtual void setPtr(const MWWorld::Ptr& ptr) {}
/// Notify that window has been made visible
virtual void onOpen() {}
/// Notify that window has been hidden

@ -1207,24 +1207,31 @@ namespace MWGui
void WindowManager::pushGuiMode(GuiMode mode)
{
if (mode==GM_Inventory && mAllowed==GW_None)
return;
pushGuiMode(mode, MWWorld::Ptr());
}
if (!mGuiModes.empty() && mGuiModes.back() == mode)
void WindowManager::pushGuiMode(GuiMode mode, const MWWorld::Ptr& arg)
{
if (mode==GM_Inventory && mAllowed==GW_None)
return;
// If this mode already exists somewhere in the stack, just bring it to the front.
if (std::find(mGuiModes.begin(), mGuiModes.end(), mode) != mGuiModes.end())
if (mGuiModes.empty() || mGuiModes.back() != mode)
{
mGuiModes.erase(std::find(mGuiModes.begin(), mGuiModes.end(), mode));
}
// If this mode already exists somewhere in the stack, just bring it to the front.
if (std::find(mGuiModes.begin(), mGuiModes.end(), mode) != mGuiModes.end())
{
mGuiModes.erase(std::find(mGuiModes.begin(), mGuiModes.end(), mode));
}
if (!mGuiModes.empty())
mGuiModeStates[mGuiModes.back()].update(false);
if (!mGuiModes.empty())
mGuiModeStates[mGuiModes.back()].update(false);
mGuiModes.push_back(mode);
mGuiModes.push_back(mode);
mGuiModeStates[mode].update(true);
mGuiModeStates[mode].update(true);
}
for (WindowBase* window : mGuiModeStates[mode].mWindows)
window->setPtr(arg);
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
@ -1543,52 +1550,11 @@ namespace MWGui
mMap->addVisitedLocation (name, x, y);
}
void WindowManager::startSpellMaking(MWWorld::Ptr actor)
{
pushGuiMode(GM_SpellCreation);
mSpellCreationDialog->startSpellMaking (actor);
}
void WindowManager::startEnchanting (MWWorld::Ptr actor)
{
pushGuiMode(GM_Enchanting);
mEnchantingDialog->startEnchanting (actor);
}
void WindowManager::startSelfEnchanting(MWWorld::Ptr soulgem)
{
mEnchantingDialog->startSelfEnchanting(soulgem);
}
void WindowManager::startTraining(MWWorld::Ptr actor)
{
pushGuiMode(GM_Training);
mTrainingWindow->startTraining(actor);
}
void WindowManager::startRepair(MWWorld::Ptr actor)
{
pushGuiMode(GM_MerchantRepair);
mMerchantRepair->startRepair(actor);
}
void WindowManager::startRepairItem(MWWorld::Ptr item)
{
pushGuiMode(MWGui::GM_Repair);
mRepair->startRepairItem(item);
}
const Translation::Storage& WindowManager::getTranslationDataStorage() const
{
return mTranslationDataStorage;
}
void WindowManager::showCompanionWindow(MWWorld::Ptr actor)
{
pushGuiMode(MWGui::GM_Companion);
mCompanionWindow->openCompanion(actor);
}
void WindowManager::changePointer(const std::string &name)
{
MyGUI::PointerManager::getInstance().setPointer(name);
@ -1642,11 +1608,6 @@ namespace MWGui
return mLoadingScreen;
}
void WindowManager::startRecharge(MWWorld::Ptr soulgem)
{
mRecharge->start(soulgem);
}
bool WindowManager::getCursorVisible()
{
return mCursorVisible;
@ -1996,53 +1957,12 @@ namespace MWGui
MWBase::Environment::get().getSoundManager()->playSound(soundId, volume, pitch, MWSound::Type::Sfx, MWSound::PlayMode::NoEnv);
}
void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object)
{
mConsole->setSelectedObject(object);
}
void WindowManager::updateSpellWindow()
{
if (mSpellWindow)
mSpellWindow->updateSpells();
}
void WindowManager::startTravel(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_Travel);
mTravelWindow->startTravel(actor);
}
void WindowManager::startSpellBuying(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_SpellBuying);
mSpellBuyingWindow->startSpellBuying(actor, 0);
}
void WindowManager::startTrade(const MWWorld::Ptr &actor)
{
pushGuiMode(GM_Barter);
mTradeWindow->startTrade(actor);
}
void WindowManager::openContainer(const MWWorld::Ptr &container, bool loot)
{
pushGuiMode(GM_Container);
mContainerWindow->openContainer(container, loot);
}
void WindowManager::showBook(const MWWorld::Ptr &item, bool showTakeButton)
{
pushGuiMode(GM_Book);
mBookWindow->openBook(item, showTakeButton);
}
void WindowManager::showScroll(const MWWorld::Ptr &item, bool showTakeButton)
{
pushGuiMode(GM_Scroll);
mScrollWindow->openScroll(item, showTakeButton);
}
std::string WindowManager::correctIconPath(const std::string& path)
{
return Misc::ResourceHelpers::correctIconPath(path, mResourceSystem->getVFS());

@ -158,7 +158,8 @@ namespace MWGui
virtual void setNewGame(bool newgame);
virtual void pushGuiMode(GuiMode mode);
virtual void pushGuiMode(GuiMode mode, const MWWorld::Ptr& arg);
virtual void pushGuiMode (GuiMode mode);
virtual void popGuiMode();
virtual void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
@ -196,8 +197,6 @@ namespace MWGui
virtual void updateSpellWindow();
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object);
///< Set value for the given ID.
virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value);
virtual void setValue (int parSkill, const MWMechanics::SkillValue& value);
@ -315,21 +314,6 @@ namespace MWGui
virtual void updatePlayer();
virtual void showCompanionWindow(MWWorld::Ptr actor);
virtual void startSpellMaking(MWWorld::Ptr actor);
virtual void startEnchanting(MWWorld::Ptr actor);
virtual void startSelfEnchanting(MWWorld::Ptr soulgem);
virtual void startTraining(MWWorld::Ptr actor);
virtual void startRepair(MWWorld::Ptr actor);
virtual void startRepairItem(MWWorld::Ptr item);
virtual void startRecharge(MWWorld::Ptr soulgem);
virtual void startTravel(const MWWorld::Ptr& actor);
virtual void startSpellBuying(const MWWorld::Ptr &actor);
virtual void startTrade(const MWWorld::Ptr &actor);
virtual void openContainer(const MWWorld::Ptr &container, bool loot);
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton);
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton);
virtual void showSoulgemDialog (MWWorld::Ptr item);
virtual void changePointer (const std::string& name);

@ -10,9 +10,8 @@
namespace MWWorld
{
ActionOpen::ActionOpen (const MWWorld::Ptr& container, bool loot)
ActionOpen::ActionOpen (const MWWorld::Ptr& container)
: Action (false, container)
, mLoot(loot)
{
}
@ -23,6 +22,6 @@ namespace MWWorld
MWMechanics::diseaseContact(actor, getTarget());
MWBase::Environment::get().getWindowManager()->openContainer(getTarget(), mLoot);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container, getTarget());
}
}

@ -12,12 +12,9 @@ namespace MWWorld
virtual void executeImp (const MWWorld::Ptr& actor);
public:
ActionOpen (const Ptr& container, bool loot=false);
ActionOpen (const Ptr& container);
///< \param container The Container the Player has activated.
/// \param loot If true, display the "dispose of corpse" button
private:
bool mLoot;
};
}

@ -32,14 +32,12 @@ namespace MWWorld
return;
}
bool showTakeButton = (getTarget().getContainerStore() != &actor.getClass().getContainerStore(actor));
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
if (ref->mBase->mData.mIsScroll)
MWBase::Environment::get().getWindowManager()->showScroll(getTarget(), showTakeButton);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll, getTarget());
else
MWBase::Environment::get().getWindowManager()->showBook(getTarget(), showTakeButton);
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book, getTarget());
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor);

@ -16,4 +16,4 @@ namespace MWWorld
};
}
#endif // ACTIONOPEN_H
#endif // ACTIONREAD_H

@ -23,6 +23,6 @@ namespace MWWorld
return;
}
MWBase::Environment::get().getWindowManager()->startRepairItem(getTarget());
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Repair, getTarget());
}
}

Loading…
Cancel
Save