1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Make TradeWindow not depend on DialogueWindow

This commit is contained in:
scrawl 2017-09-25 18:07:49 +02:00
parent 82a211ba03
commit b7752ec52d
5 changed files with 12 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

View File

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