Skip to content

Commit

Permalink
Fix issues with ready status
Browse files Browse the repository at this point in the history
- Auto-ready does not apply while last map change is invalid
- Fix launch button text for ready/not ready being shown wrong way around (e.g ready when not ready)
  • Loading branch information
Starkku committed Jan 3, 2025
1 parent bdbd6a6 commit a0f2d15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ protected override void BroadcastPlayerOptions()
sb.Append(";");
if (!pInfo.IsAI)
{
if (pInfo.AutoReady && !pInfo.IsInGame)
if (pInfo.AutoReady && !pInfo.IsInGame && !LastMapChangeWasInvalid)
sb.Append(2);
else
sb.Append(Convert.ToInt32(pInfo.Ready));
Expand Down Expand Up @@ -951,7 +951,7 @@ private void ApplyPlayerOptions(string sender, string message)
pInfo.AutoReady = readyStatus > 1;

if (pInfo.Name == ProgramConstants.PLAYERNAME)
btnLaunchGame.Text = pInfo.Ready ? BTN_LAUNCH_NOT_READY : BTN_LAUNCH_READY;
btnLaunchGame.Text = pInfo.Ready ? BTN_LAUNCH_READY : BTN_LAUNCH_NOT_READY;

Players.Add(pInfo);
i += HUMAN_PLAYER_OPTIONS_LENGTH;
Expand Down
2 changes: 1 addition & 1 deletion DXMainClient/DXGUI/Multiplayer/GameLobby/LANGameLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ protected override void BroadcastPlayerOptions()
sb.Append(pInfo.ColorId);
sb.Append(pInfo.StartingLocation);
sb.Append(pInfo.TeamId);
if (pInfo.AutoReady && !pInfo.IsInGame)
if (pInfo.AutoReady && !pInfo.IsInGame && !LastMapChangeWasInvalid)
sb.Append(2);
else
sb.Append(Convert.ToInt32(pInfo.IsAI || pInfo.Ready));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected bool Locked

private bool gameSaved = false;

private bool lastMapChangeWasInvalid = false;
protected bool LastMapChangeWasInvalid { get; set; } = false;

/// <summary>
/// Allows derived classes to add their own chat box commands.
Expand Down Expand Up @@ -1108,10 +1108,10 @@ protected override void ChangeMap(GameModeMap gameModeMap)

ClearReadyStatuses(resetAutoReady);

if ((lastMapChangeWasInvalid || resetAutoReady) && chkAutoReady.Checked)
if ((LastMapChangeWasInvalid || resetAutoReady) && chkAutoReady.Checked)
RequestReadyStatus();

lastMapChangeWasInvalid = resetAutoReady;
LastMapChangeWasInvalid = resetAutoReady;

//if (IsHost)
// OnGameOptionChanged();
Expand Down

0 comments on commit a0f2d15

Please sign in to comment.