mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Force windows to exit when popping their GUI mode through Lua
This commit is contained in:
parent
6653502567
commit
989686500c
@ -120,7 +120,7 @@ namespace MWBase
|
||||
|
||||
virtual void pushGuiMode(MWGui::GuiMode mode, const MWWorld::Ptr& arg) = 0;
|
||||
virtual void pushGuiMode(MWGui::GuiMode mode) = 0;
|
||||
virtual void popGuiMode() = 0;
|
||||
virtual void popGuiMode(bool forceExit = false) = 0;
|
||||
|
||||
virtual void removeGuiMode(MWGui::GuiMode mode) = 0;
|
||||
///< can be anywhere in the stack
|
||||
|
@ -1303,7 +1303,7 @@ namespace MWGui
|
||||
return mViewer->getCamera()->getCullMask();
|
||||
}
|
||||
|
||||
void WindowManager::popGuiMode()
|
||||
void WindowManager::popGuiMode(bool forceExit)
|
||||
{
|
||||
if (mDragAndDrop && mDragAndDrop->mIsOnDragAndDrop)
|
||||
{
|
||||
@ -1313,6 +1313,12 @@ namespace MWGui
|
||||
if (!mGuiModes.empty())
|
||||
{
|
||||
const GuiMode mode = mGuiModes.back();
|
||||
if (forceExit)
|
||||
{
|
||||
GuiModeState& state = mGuiModeStates[mode];
|
||||
for (const auto& window : state.mWindows)
|
||||
window->exit();
|
||||
}
|
||||
mKeyboardNavigation->saveFocus(mode);
|
||||
mGuiModes.pop_back();
|
||||
mGuiModeStates[mode].update(false);
|
||||
|
@ -150,7 +150,7 @@ namespace MWGui
|
||||
|
||||
void pushGuiMode(GuiMode mode, const MWWorld::Ptr& arg) override;
|
||||
void pushGuiMode(GuiMode mode) override;
|
||||
void popGuiMode() override;
|
||||
void popGuiMode(bool forceExit = false) override;
|
||||
void removeGuiMode(GuiMode mode) override; ///< can be anywhere in the stack
|
||||
|
||||
void goToJail(int days) override;
|
||||
|
@ -255,7 +255,7 @@ namespace MWLua
|
||||
// TODO: Maybe disallow opening/closing special modes (main menu, settings, loading screen)
|
||||
// from player scripts. Add new Lua context "menu" that can do it.
|
||||
for (unsigned i = stack.size() - common; i > 0; i--)
|
||||
windowManager->popGuiMode();
|
||||
windowManager->popGuiMode(true);
|
||||
if (common == newStack.size() && !newStack.empty() && arg.has_value())
|
||||
windowManager->pushGuiMode(newStack.back(), ptr);
|
||||
for (unsigned i = common; i < newStack.size(); ++i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user