Skip to content

Commit

Permalink
Fix on topic change broadcasting player options
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantBartlett committed Oct 19, 2024
1 parent 61d915c commit fe09dad
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit fe09dad

Please sign in to comment.