Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/client/StarClientApplication.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-29 02:12:03 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-29 02:12:03 +1000
commit224ad2c2c07311475875d1d243354f8647112b45 (patch)
treec8247f22b4ddda345b7f35d7c6ead25d5e1f2791 /source/client/StarClientApplication.cpp
parent35fc2679dea7b625bf559c6855e101fc62e613f4 (diff)
Reset script panes on character swap
Diffstat (limited to 'source/client/StarClientApplication.cpp')
-rw-r--r--source/client/StarClientApplication.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index ab620b4..efbdcad 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -510,10 +510,23 @@ void ClientApplication::changeState(MainAppState newState) {
m_universeClient->setLuaCallbacks("input", LuaBindings::makeInputCallbacks());
m_universeClient->setLuaCallbacks("voice", LuaBindings::makeVoiceCallbacks());
- m_universeClient->playerReloadCallback() = [&]() {
- if (auto paneManager = m_mainInterface->paneManager()) {
- if (auto inventory = paneManager->registeredPane<InventoryPane>(MainInterfacePanes::Inventory))
- inventory->clearChangedSlots();
+ auto heldScriptPanes = make_shared<List<MainInterface::ScriptPaneInfo>>();
+
+ m_universeClient->playerReloadPreCallback() = [&, heldScriptPanes](bool resetInterface) {
+ if (!resetInterface)
+ return;
+
+ m_mainInterface->takeScriptPanes(*heldScriptPanes);
+ };
+
+ m_universeClient->playerReloadCallback() = [&, heldScriptPanes](bool resetInterface) {
+ auto paneManager = m_mainInterface->paneManager();
+ if (auto inventory = paneManager->registeredPane<InventoryPane>(MainInterfacePanes::Inventory))
+ inventory->clearChangedSlots();
+
+ if (resetInterface) {
+ m_mainInterface->reviveScriptPanes(*heldScriptPanes);
+ heldScriptPanes->clear();
}
};