[Client] Make it possible to get ContainerWindow from elsewhere in code

pull/396/head
David Cernat 7 years ago
parent bbdc30628b
commit bb15ee9215

@ -145,6 +145,17 @@ namespace MWBase
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
virtual MWGui::TradeWindow* getTradeWindow() = 0;
/*
Start of tes3mp addition
Make it possible to get the ContainerWindow from elsewhere
in the code
*/
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
/*
End of tes3mp addition
*/
/// Make the player use an item, while updating GUI state accordingly
virtual void useItem(const MWWorld::Ptr& item) = 0;

@ -384,10 +384,19 @@ namespace MWGui
mGuiModeStates[GM_Dialogue] = GuiModeState(mDialogueWindow);
mTradeWindow->eventTradeDone += MyGUI::newDelegate(mDialogueWindow, &DialogueWindow::onTradeComplete);
ContainerWindow* containerWindow = new ContainerWindow(mDragAndDrop);
mWindows.push_back(containerWindow);
trackWindow(containerWindow, "container");
mGuiModeStates[GM_Container] = GuiModeState({containerWindow, mInventoryWindow});
/*
Start of tes3mp change (major)
Use a member variable (mContainerWIndow) instead of a local one so
we can access it from elsewhere
*/
mContainerWindow = new ContainerWindow(mDragAndDrop);
mWindows.push_back(mContainerWindow);
trackWindow(mContainerWindow, "container");
mGuiModeStates[GM_Container] = GuiModeState({mContainerWindow, mInventoryWindow});
/*
End of tes3mp change (major)
*/
mHud = new HUD(mCustomMarkers, mDragAndDrop, mLocalMapRender);
mWindows.push_back(mHud);
@ -1399,6 +1408,17 @@ namespace MWGui
MWGui::ConfirmationDialog* WindowManager::getConfirmationDialog() { return mConfirmationDialog; }
MWGui::TradeWindow* WindowManager::getTradeWindow() { return mTradeWindow; }
/*
Start of tes3mp addition
Make it possible to get the ContainerWindow from elsewhere
in the code
*/
MWGui::ContainerWindow* WindowManager::getContainerWindow() { return mContainerWindow; }
/*
End of tes3mp addition
*/
void WindowManager::useItem(const MWWorld::Ptr &item)
{
if (mInventoryWindow)

@ -184,6 +184,17 @@ namespace MWGui
virtual MWGui::ConfirmationDialog* getConfirmationDialog();
virtual MWGui::TradeWindow* getTradeWindow();
/*
Start of tes3mp addition
Make it possible to get the ContainerWindow from elsewhere
in the code
*/
virtual MWGui::ContainerWindow* getContainerWindow();
/*
End of tes3mp addition
*/
/// Make the player use an item, while updating GUI state accordingly
virtual void useItem(const MWWorld::Ptr& item);
@ -510,6 +521,17 @@ namespace MWGui
DebugWindow* mDebugWindow;
JailScreen* mJailScreen;
/*
Start of tes3mp addition
Keep a pointer to the container window because of its usefulness
in multiplayer for container sync
*/
ContainerWindow* mContainerWindow;
/*
End of tes3mp addition
*/
std::vector<WindowBase*> mWindows;
Translation::Storage& mTranslationDataStorage;

Loading…
Cancel
Save