From 81154df155d78b60a0c77d923cc41a598f43319b Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 26 Nov 2022 17:04:12 +0100 Subject: [PATCH] Improve Server Browser host panel * Immediately display the "Stop Server" and "Change Level" buttons when hoststate indicated there is an active game, since stopping the server or switching levels is still valid when the server is not simulating. * Only display the AINetwork/NavMesh rebuild/reload and Settings Reparse buttons when the server is simulating. --- r5dev/gameui/IBrowser.cpp | 61 ++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index a107746c..d11634a5 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -485,7 +485,7 @@ void CBrowser::HostPanel(void) } ImGui::Spacing(); - if (!g_pServer->IsActive()) + if (!g_pHostState->m_bActiveGame) { if (ImGui::Button("Start Server", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) { @@ -557,39 +557,42 @@ void CBrowser::HostPanel(void) } } - ImGui::Spacing(); - ImGui::Separator(); - ImGui::Spacing(); - - if (ImGui::Button("Rebuild AI Network", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) + if (g_pServer->IsActive()) { - ProcessCommand("BuildAINFile"); - } + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Spacing(); - if (ImGui::Button("NavMesh Hot Swap", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) - { - ProcessCommand("navmesh_hotswap"); - } - - ImGui::Spacing(); - ImGui::Separator(); - ImGui::Spacing(); - - if (ImGui::Button("AI Settings Reparse", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) - { - DevMsg(eDLL_T::ENGINE, "Reparsing AI data on %s\n", g_pClientState->IsActive() ? "server and client" : "server"); - ProcessCommand("aisettings_reparse"); - - if (g_pClientState->IsActive()) + if (ImGui::Button("Rebuild AI Network", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) { - ProcessCommand("aisettings_reparse_client"); + ProcessCommand("BuildAINFile"); } - } - if (ImGui::Button("Weapon Settings Reparse", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) - { - DevMsg(eDLL_T::ENGINE, "Reparsing weapon data on %s\n", g_pClientState->IsActive() ? "server and client" : "server"); - ProcessCommand("weapon_reparse"); + if (ImGui::Button("NavMesh Hot Swap", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) + { + ProcessCommand("navmesh_hotswap"); + } + + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Spacing(); + + if (ImGui::Button("AI Settings Reparse", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) + { + DevMsg(eDLL_T::ENGINE, "Reparsing AI data on %s\n", g_pClientState->IsActive() ? "server and client" : "server"); + ProcessCommand("aisettings_reparse"); + + if (g_pClientState->IsActive()) + { + ProcessCommand("aisettings_reparse_client"); + } + } + + if (ImGui::Button("Weapon Settings Reparse", ImVec2(ImGui::GetWindowContentRegionWidth(), 32))) + { + DevMsg(eDLL_T::ENGINE, "Reparsing weapon data on %s\n", g_pClientState->IsActive() ? "server and client" : "server"); + ProcessCommand("weapon_reparse"); + } } } #endif // !CLIENT_DLL