Make TradeWindow not depend on DialogueWindow

pull/303/head
scrawl 7 years ago
parent 82a211ba03
commit b7752ec52d

@ -270,6 +270,11 @@ namespace MWGui
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize); mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
} }
void DialogueWindow::onTradeComplete()
{
addResponse(MyGUI::LanguageManager::getInstance().replaceTags("#{sBarterDialog5}"));
}
bool DialogueWindow::exit() bool DialogueWindow::exit()
{ {
if ((!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice()) if ((!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())

@ -99,6 +99,8 @@ namespace MWGui
public: public:
DialogueWindow(); DialogueWindow();
void onTradeComplete();
virtual bool exit(); virtual bool exit();
// Events // Events

@ -27,7 +27,6 @@
#include "containeritemmodel.hpp" #include "containeritemmodel.hpp"
#include "tradeitemmodel.hpp" #include "tradeitemmodel.hpp"
#include "countdialog.hpp" #include "countdialog.hpp"
#include "dialogue.hpp"
#include "controllers.hpp" #include "controllers.hpp"
namespace namespace
@ -358,8 +357,7 @@ namespace MWGui
mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance ); mPtr.getClass().getCreatureStats(mPtr).getGoldPool() - mCurrentBalance );
} }
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse( eventTradeDone();
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString());
MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up"); MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);

@ -41,6 +41,9 @@ namespace MWGui
virtual void resetReference(); virtual void resetReference();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_TradeDone;
EventHandle_TradeDone eventTradeDone;
private: private:
ItemView* mItemView; ItemView* mItemView;
SortFilterItemModel* mSortModel; SortFilterItemModel* mSortModel;

@ -337,7 +337,6 @@ namespace MWGui
mTradeWindow = new TradeWindow(); mTradeWindow = new TradeWindow();
mWindows.push_back(mTradeWindow); mWindows.push_back(mTradeWindow);
trackWindow(mTradeWindow, "barter"); trackWindow(mTradeWindow, "barter");
mGuiModeStates[GM_Barter] = GuiModeState({mInventoryWindow, mTradeWindow}); mGuiModeStates[GM_Barter] = GuiModeState({mInventoryWindow, mTradeWindow});
mConsole = new Console(w,h, mConsoleOnlyScripts); mConsole = new Console(w,h, mConsoleOnlyScripts);
@ -366,6 +365,7 @@ namespace MWGui
mWindows.push_back(mDialogueWindow); mWindows.push_back(mDialogueWindow);
trackWindow(mDialogueWindow, "dialogue"); trackWindow(mDialogueWindow, "dialogue");
mGuiModeStates[GM_Dialogue] = GuiModeState(mDialogueWindow); mGuiModeStates[GM_Dialogue] = GuiModeState(mDialogueWindow);
mTradeWindow->eventTradeDone += MyGUI::newDelegate(mDialogueWindow, &DialogueWindow::onTradeComplete);
ContainerWindow* containerWindow = new ContainerWindow(mDragAndDrop); ContainerWindow* containerWindow = new ContainerWindow(mDragAndDrop);
mWindows.push_back(containerWindow); mWindows.push_back(containerWindow);

Loading…
Cancel
Save