Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions DXMainClient/DXGUI/Multiplayer/CnCNet/CnCNetLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ private string GetJoinGameError(HostedCnCNetGame hg)
return "Cannot join game. The host is on a different game version than you.".L10N("Client:Main:DisallowJoiningIncompatibleGames");

if (hg.Locked)
return "The selected game is locked!".L10N("Client:Main:GameLocked");
return string.Format("The game {0} is locked!".L10N("Client:Main:GameLockedWithName"), hg.RoomName);

if (hg.IsLoadedGame && !hg.Players.Contains(ProgramConstants.PLAYERNAME))
return "You do not exist in the saved game!".L10N("Client:Main:NotInSavedGame");
Expand Down Expand Up @@ -964,17 +964,21 @@ private void GameChannel_ChannelFull(object sender, EventArgs e) =>

private void GameChannel_InviteOnlyErrorOnJoin(object sender, EventArgs e)
{
connectionManager.MainChannel.AddMessage(new ChatMessage(Color.White, "The selected game is locked!".L10N("Client:Main:GameLocked")));
var channel = (Channel)sender;

var game = FindGameByChannelName(channel.ChannelName);
if (game != null)
{
connectionManager.MainChannel.AddMessage(new ChatMessage(Color.White, string.Format("The game {0} is locked!".L10N("Client:Main:GameLockedWithName"), game.RoomName)));
game.Locked = true;
SortAndRefreshHostedGames();
}
else
{
connectionManager.MainChannel.AddMessage(new ChatMessage(Color.White, "The selected game is locked!".L10N("Client:Main:GameLocked")));
}

ClearGameJoinAttempt((Channel)sender);
ClearGameJoinAttempt((Channel)sender);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format

}

private HostedCnCNetGame FindGameByChannelName(string channelName)
Expand Down Expand Up @@ -1795,6 +1799,13 @@ private void JoinUser(IRCUser user, IMessageView messageView)
return;
}

int gameIndex = lbGameList.Items.FindIndex(item => item.Tag == game);
if (gameIndex >= 0)
{
lbGameList.SelectedIndex = gameIndex;
lbGameList.ScrollToSelectedElement();
}

JoinGame(game, string.Empty, messageView);
}
}
Expand Down
2 changes: 1 addition & 1 deletion DXMainClient/DXGUI/Multiplayer/LANLobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ private void LbGameList_DoubleLeftClick(object sender, EventArgs e)

if (hg.Locked)
{
AddChatMessage("The selected game is locked!".L10N("Client:Main:GameLocked"));
AddChatMessage(string.Format("The game {0} is locked!".L10N("Client:Main:GameLockedWithName"), hg.RoomName));
return;
}

Expand Down
Loading