From fe09dad4e8b66c3caedfdac75460e199b87a3208 Mon Sep 17 00:00:00 2001 From: Grant Bartlett Date: Sat, 19 Oct 2024 11:03:37 +0100 Subject: [PATCH] Fix on topic change broadcasting player options --- .../Multiplayer/GameLobby/CnCNetGameLobby.cs | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index 7970ef51a..223f61157 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -382,36 +382,20 @@ public override void Clear() private void Channel_TopicChanged(object sender, MessageEventArgs e) { - if (closed && IsHost) - { - OnHostLeftGame(); - } - else - { - ParseGameTopic(e.Message); - } - } - - private void OnHostLeftGame() - { - Clear(); - channel.Leave(); + ParseGameTopic(e.Message); } public void LeaveGameLobby() { if (IsHost) { - // We need to succesfully change the topic first before we can leave the channel - btnLeaveGame.Enabled = false; closed = true; - UpdateChannelTopic(); - } - else - { - Clear(); - channel.Leave(); + Locked = true; // So no-one can join our potentially ghosted game + UpdateChannelTopic(); // Mark it as closed } + + Clear(); + channel.Leave(); } @@ -739,7 +723,7 @@ protected override void RequestReadyStatus() // Update our own client UI immediatly so its not waiting for the server to respond pInfo.Ready = readyState > 0; pInfo.AutoReady = readyState > 1; - btnLaunchGame.Text = pInfo.Ready ? BTN_LAUNCH_NOT_READY : BTN_LAUNCH_READY; + //btnLaunchGame.Text = pInfo.Ready ? BTN_LAUNCH_NOT_READY : BTN_LAUNCH_READY; // Copy the player data to the UI so it shows up CopyPlayerDataToUI(); @@ -1918,6 +1902,7 @@ private void ParseGameTopic(string topic) ApplyGameOptionsFromTopic(gameOptions.Substring(3)); // Remove the "GO " prefix ApplyPlayerExtraOptionsFromTopic(extraPlayerOptions.Substring(4)); // Remove the "PEO " prefix + BroadcastPlayerOptions(); CopyPlayerDataToUI(); }