diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 9a906e0d485..be658f4a361 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -772,6 +772,7 @@ ChatLounge.notDone=Not Done ChatLounge.PartialRepairs=Partial Repairs ChatLounge.Player=Player ChatLounge.Players=Players +ChatLounge.Player0=Player0 ChatLounge.quickView=Unit Quick View ChatLounge.OverlapDeploy.title=Must choose exclusive deployment zone ChatLounge.OverlapDeploy.msg=When using double blind, each player needs to have an exclusive deployment zone. diff --git a/megamek/src/megamek/client/ui/swing/lobby/LobbyUtility.java b/megamek/src/megamek/client/ui/swing/lobby/LobbyUtility.java index e56f521369a..a41c8223ff2 100644 --- a/megamek/src/megamek/client/ui/swing/lobby/LobbyUtility.java +++ b/megamek/src/megamek/client/ui/swing/lobby/LobbyUtility.java @@ -73,11 +73,22 @@ static boolean isValidStartPos(Game game, Player player, int pos) { if (!isExclusiveDeployment(game)) { return true; } else { + final GameOptions gOpts = game.getOptions(); + List players = game.getPlayersList(); + + if (gOpts.booleanOption(OptionsConstants.BASE_SET_PLAYER_DEPLOYMENT_TO_PLAYER0) && !player.isBot() && player.getId() != 0) { + return true; + } + + if (gOpts.booleanOption(OptionsConstants.BASE_SET_PLAYER_DEPLOYMENT_TO_PLAYER0)) { + players = players.stream().filter(p -> p.isBot() || p.getId() == 0).collect(Collectors.toList()); + } + if (isTeamsShareVision(game)) { - return game.getPlayersVector().stream().filter(p -> p.isEnemyOf(player)) + return players.stream().filter(p -> p.isEnemyOf(player)) .noneMatch(p -> startPosOverlap(pos, p.getStartingPos())); } else { - return game.getPlayersVector().stream().filter(p -> !p.equals(player)) + return players.stream().filter(p -> !p.equals(player)) .noneMatch(p -> startPosOverlap(pos, p.getStartingPos())); } } diff --git a/megamek/src/megamek/client/ui/swing/lobby/PlayerTable.java b/megamek/src/megamek/client/ui/swing/lobby/PlayerTable.java index 0b320781159..d8e771c3ec3 100644 --- a/megamek/src/megamek/client/ui/swing/lobby/PlayerTable.java +++ b/megamek/src/megamek/client/ui/swing/lobby/PlayerTable.java @@ -25,6 +25,7 @@ import megamek.client.ui.swing.util.UIUtil; import megamek.common.IStartingPositions; import megamek.common.Player; +import megamek.common.options.GameOptions; import megamek.common.options.OptionsConstants; import javax.swing.*; @@ -195,7 +196,11 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole result.append(guiScaledFontHTML()); String msg_start = Messages.getString("ChatLounge.Start"); - if ((player.getStartingPos() >= 0) && (player.getStartingPos() <= IStartingPositions.START_LOCATION_NAMES.length)) { + + final GameOptions gOpts = lobby.game().getOptions(); + if (gOpts.booleanOption(OptionsConstants.BASE_SET_PLAYER_DEPLOYMENT_TO_PLAYER0) && !player.isBot() && player.getId() != 0) { + result.append(msg_start + ": " + Messages.getString("ChatLounge.Player0")); + } else if ((player.getStartingPos() >= 0) && (player.getStartingPos() <= IStartingPositions.START_LOCATION_NAMES.length)) { result.append(msg_start + ": " + IStartingPositions.START_LOCATION_NAMES[player.getStartingPos()]); int so = player.getStartOffset(); int sw = player.getStartWidth();