Skip to content

Commit 2b20dc9

Browse files
authored
Merge branch 'main' into InfantryCustomArmorFix
2 parents f56bcbe + b1ae3cc commit 2b20dc9

File tree

24 files changed

+469
-153
lines changed

24 files changed

+469
-153
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ build/
4545
!/megamek/mmconf/shared.properties
4646
/megamek/mmconf/*.properties.bak
4747
/megamek/mmconf/*.preferences
48+
/megamek/mmconf/searches/*.json
49+
/megamek/mmconf/recent-advanced-searches.json
4850

4951
# UserData
5052
megamek/userdata/**

megamek/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ tasks.register('copyFiles', Copy) {
207207
exclude "mmconf/mhq.preferences"
208208
exclude "mmconf/mm.preferences"
209209
exclude "mmconf/mml.preferences"
210+
exclude "mmconf/recent-advanced-searches.json"
211+
exclude "mmconf/searches/*.json"
210212

211213
include "userdata/"
212214

megamek/resources/megamek/client/messages.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ ChatLounge.name.selectUnits=Select Units
791791
ChatLounge.name.spaceMap=Space Map
792792
ChatLounge.name.teamOverview=Team Overview
793793
ChatLounge.name.unitSetup=Unit Setup
794+
ChatLounge.name.networkOverview=Network Overview
794795
ChatLounge.noCamo=No Camo
795796
ChatLounge.noCmdr.title=No Commander!
796797
ChatLounge.noCmdr.msg=Commander killed victory is selected but the following players don't have a commander:\n
@@ -1132,6 +1133,7 @@ CommonMenuBar.viewAccessibilityWindow=Accessibility Window
11321133
CommonMenuBar.viewIncGUIScale=Increase GUI Scale
11331134
CommonMenuBar.viewDecGUIScale=Decrease GUI Scale
11341135
CommonMenuBar.viewKeyboardShortcuts=Keyboard Shortcuts
1136+
CommonMenuBar.viewNetworkInformation=Network Information
11351137
CommonMenuBar.viewPlanetaryConditions=Planetary Conditions
11361138
CommonMenuBar.ViewMenu=View
11371139
CommonMenuBar.viewMinimap=Minimap
@@ -2615,6 +2617,8 @@ MekView.unitType.fixedWingSupport=Fixed Wing Support
26152617
MekView.unitType.support=Support
26162618
MekView.unitType.spaceStation=Space Station
26172619
MekView.unitType.jumpShip=JumpShip
2620+
MekView.unitType.advancedBuilding=Advanced Building
2621+
MekView.unitType.mobileStructure=Mobile Structure
26182622
MekView.unitType.warShip=WarShip
26192623
MekView.unitType.dropShip=DropShip
26202624
MekView.unitType.smallCraft=Small Craft
@@ -3550,6 +3554,13 @@ MissionRole.generator=Generator
35503554
MissionRole.generator.tooltip=Structure provides power for dependent buildings.
35513555
MissionRole.control=Control center
35523556
MissionRole.control.tooltip=Structure controls other structures.
3557+
#Network Information Dialog Text
3558+
NetworkInformation.localIP=Local IP Address:
3559+
NetworkInformation.remoteIP=Public IP Address:
3560+
NetworkInformation.connectedIP=Game Connected to:
3561+
NetworkInformation.buttonShowIPs=Show/Hide address
3562+
NetworkInformation.blankIP=No Address
3563+
NetworkInformation.title=Network Information
35533564
#Random Map Dialog
35543565
RandomMapDialog.ShowAtStart=<HTML><I><FONT SIZE = -2>Show at Map Editor startup
35553566
RandomMapDialog.mountainPlain=Plain

megamek/resources/megamek/common/options/messages.properties

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,12 +1002,14 @@ QuirksInfo.option.reinforced_legs.rulesBook=BMM
10021002
QuirksInfo.option.reinforced_legs.rulesPage=85
10031003
QuirksInfo.option.reinforced_legs.working=1
10041004
QuirksInfo.option.rugged_1.displayableName=Rugged (1 Point)
1005-
QuirksInfo.option.rugged_1.description=Mek is extremely reliable and doesn't need as much Maintenance. It can go twice as long between Maintenance checks.
1005+
QuirksInfo.option.rugged_1.description=Mek is extremely reliable and doesn't need as much maintenance. It can go \
1006+
twice as long between maintenance checks.
10061007
QuirksInfo.option.rugged_1.rulesBook=BMM
10071008
QuirksInfo.option.rugged_1.rulesPage=85
10081009
QuirksInfo.option.rugged_1.working=1
10091010
QuirksInfo.option.rugged_2.displayableName=Rugged (2 Point)
1010-
QuirksInfo.option.rugged_2.description=Mek is extremely reliable and doesn't need as much Maintenance. It can go three times as long between Maintenance checks.
1011+
QuirksInfo.option.rugged_2.description=Mek is extremely reliable and doesn't need as much maintenance. It can go \
1012+
three times as long between maintenance checks.
10111013
QuirksInfo.option.rugged_2.rulesBook=BMM
10121014
QuirksInfo.option.rugged_2.rulesPage=85
10131015
QuirksInfo.option.rugged_2.working=1
@@ -1296,7 +1298,7 @@ WeaponQuirksInfo.option.direct_torso_mount.description=The weapon can be flipped
12961298
WeaponQuirksInfo.option.em_interference.displayableName=EM Interference
12971299
WeaponQuirksInfo.option.em_interference.description=Firing this weapon causes Electromagnetic Interference against this vehicle for 1 turn.\nNot yet implemented. (BMM pg 87)
12981300
WeaponQuirksInfo.option.exposed_linkage.displayableName=Exposed Weapon Linkage
1299-
WeaponQuirksInfo.option.exposed_linkage.description=This weapon takes a critical on a roll of 10+ if it's housing location is hit.\nNot yet implemented. (SO pg 198)
1301+
WeaponQuirksInfo.option.exposed_linkage.description=This weapon takes a critical on a roll of 10+ if its housing location is hit.\nNot yet implemented. (SO pg 198)
13001302
WeaponQuirksInfo.option.fast_reload.displayableName=Fast Reload
13011303
WeaponQuirksInfo.option.fast_reload.description=No game effect,\ncurrently. (SO pg 194)
13021304
WeaponQuirksInfo.option.imp_cooling.displayableName=Improved Cooling Jacket

megamek/src/megamek/client/ui/clientGUI/ClientGUI.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
import megamek.client.ui.dialogs.buttonDialogs.EditBotsDialog;
106106
import megamek.client.ui.dialogs.buttonDialogs.GameOptionsDialog;
107107
import megamek.client.ui.dialogs.buttonDialogs.LOSDialog;
108+
import megamek.client.ui.dialogs.buttonDialogs.NetworkInformationDialog;
108109
import megamek.client.ui.dialogs.forceDisplay.ForceDisplayDialog;
109110
import megamek.client.ui.dialogs.forceDisplay.ForceDisplayPanel;
110111
import megamek.client.ui.dialogs.helpDialogs.AbstractHelpDialog;
@@ -278,6 +279,7 @@ public class ClientGUI extends AbstractClientGUI
278279
public static final String VIEW_CHANGE_THEME = "viewChangeTheme";
279280
public static final String VIEW_ROUND_REPORT = "viewRoundReport";
280281
public static final String VIEW_GAME_OPTIONS = "viewGameOptions";
282+
public static final String VIEW_NETWORK_INFORMATION = "viewNetworkInformation";
281283
public static final String VIEW_CLIENT_SETTINGS = "viewClientSettings";
282284
public static final String VIEW_LOS_SETTING = "viewLOSSetting";
283285
public static final String VIEW_PLAYER_SETTINGS = "viewPlayerSettings";
@@ -372,6 +374,7 @@ public class ClientGUI extends AbstractClientGUI
372374

373375
// some dialogs...
374376
private GameOptionsDialog gameOptionsDialog;
377+
private NetworkInformationDialog networkInformationDialog;
375378
private MegaMekUnitSelectorDialog mekSelectorDialog;
376379
private PlayerListDialog playerListDialog;
377380
private RandomArmyDialog randomArmyDialog;
@@ -882,6 +885,14 @@ private void showOptions() {
882885
getGameOptionsDialog().setVisible(true);
883886
}
884887

888+
private void showNetworkInformation() {
889+
// Display the network information screen
890+
getNetworkInformationDialog().refresh();
891+
getNetworkInformationDialog().pack();
892+
getNetworkInformationDialog().setVisible(true);
893+
}
894+
895+
885896
public void customizePlayer() {
886897
PlayerSettingsDialog psd = new PlayerSettingsDialog(this, client, (BoardView) boardViews.get(0));
887898
psd.setVisible(true);
@@ -959,6 +970,9 @@ public void resetWindowPositions() {
959970
if (gameOptionsDialog != null) {
960971
gameOptionsDialog.setBounds(0, 0, gameOptionsDialog.getWidth(), gameOptionsDialog.getHeight());
961972
}
973+
if (networkInformationDialog != null) {
974+
networkInformationDialog.setBounds(0, 0, networkInformationDialog.getWidth(), networkInformationDialog.getHeight());
975+
}
962976
if (commonSettingsDialog != null) {
963977
commonSettingsDialog.setBounds(0, 0, commonSettingsDialog.getWidth(), commonSettingsDialog.getHeight());
964978
}
@@ -1070,6 +1084,9 @@ public void actionPerformed(ActionEvent event) {
10701084
case VIEW_GAME_OPTIONS:
10711085
showOptions();
10721086
break;
1087+
case VIEW_NETWORK_INFORMATION:
1088+
showNetworkInformation();
1089+
break;
10731090
case VIEW_PLAYER_SETTINGS:
10741091
customizePlayer();
10751092
break;
@@ -1350,6 +1367,13 @@ public GameOptionsDialog getGameOptionsDialog() {
13501367
}
13511368
return gameOptionsDialog;
13521369
}
1370+
1371+
public NetworkInformationDialog getNetworkInformationDialog() {
1372+
if (networkInformationDialog == null) {
1373+
networkInformationDialog = new NetworkInformationDialog(this);
1374+
}
1375+
return networkInformationDialog;
1376+
}
13531377

13541378
public MegaMekUnitSelectorDialog getMekSelectorDialog() {
13551379
return mekSelectorDialog;

megamek/src/megamek/client/ui/clientGUI/CommonMenuBar.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public class CommonMenuBar extends JMenuBar implements ActionListener, IPreferen
9696
private final JCheckBoxMenuItem gamePlayerList = new JCheckBoxMenuItem(getString("CommonMenuBar.viewPlayerList"));
9797
private final JMenuItem gameGameOptions = new JMenuItem(getString("CommonMenuBar.viewGameOptions"));
9898
private final JMenuItem gamePlayerSettings = new JMenuItem(getString("CommonMenuBar.viewPlayerSettings"));
99+
private final JMenuItem gameNetworkInformation = new JMenuItem(getString("CommonMenuBar.viewNetworkInformation"));
99100

100101
// The Units menu
101102
private final JMenuItem fileUnitsReinforce = new JMenuItem(getString("CommonMenuBar.fileUnitsReinforce"));
@@ -233,6 +234,7 @@ private CommonMenuBar(boolean isMainMenu, boolean isGame, boolean isBoardEditor)
233234

234235
initMenuItem(gameGameOptions, menu, VIEW_GAME_OPTIONS, VK_O);
235236
initMenuItem(gamePlayerSettings, menu, VIEW_PLAYER_SETTINGS);
237+
initMenuItem(gameNetworkInformation, menu, VIEW_NETWORK_INFORMATION);
236238
initMenuItem(fileUnitsCopy, menu, FILE_UNITS_COPY);
237239
fileUnitsCopy.setAccelerator(KeyStroke.getKeyStroke(VK_C, CTRL_DOWN_MASK));
238240
initMenuItem(fileUnitsPaste, menu, FILE_UNITS_PASTE);
@@ -538,6 +540,7 @@ private synchronized void updateEnabledStates() {
538540
viewLabels.setEnabled(isInGameBoardView);
539541

540542
gameGameOptions.setEnabled(isInGame || isLobby);
543+
gameNetworkInformation.setEnabled(isInGame || isLobby || isMainMenu);
541544
gamePlayerSettings.setEnabled(isInGame);
542545

543546
viewMinimap.setEnabled(isBoardView);

megamek/src/megamek/client/ui/clientGUI/MegaMekGUI.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
import megamek.client.ui.dialogs.buttonDialogs.BotConfigDialog;
8787
import megamek.client.ui.dialogs.buttonDialogs.CommonSettingsDialog;
8888
import megamek.client.ui.dialogs.buttonDialogs.GameOptionsDialog;
89+
import megamek.client.ui.dialogs.buttonDialogs.NetworkInformationDialog;
8990
import megamek.client.ui.dialogs.clientDialogs.PlanetaryConditionsDialog;
9091
import megamek.client.ui.dialogs.gameConnectionDialogs.ConnectDialog;
9192
import megamek.client.ui.dialogs.gameConnectionDialogs.HostDialog;
@@ -162,6 +163,7 @@ public class MegaMekGUI implements IPreferenceChangeListener {
162163
private ManagedVolatileImage medalImage;
163164
private TipOfTheDay tipOfTheDay;
164165
private AbstractRandomArmyDialog randomArmyDialog;
166+
private NetworkInformationDialog networkInformationDialog;
165167

166168
private static MegaMekController controller;
167169

@@ -1012,7 +1014,7 @@ void scenario(String fileName) {
10121014
orig.setValue(opt.getValue());
10131015
}
10141016
}
1015-
1017+
10161018
// popup planetary conditions dialog
10171019
if ((game instanceof PlanetaryConditionsUsing plGame) && !scenario.hasFixedPlanetaryConditions()) {
10181020
PlanetaryConditionsDialog pcd = new PlanetaryConditionsDialog(frame, plGame.getPlanetaryConditions());
@@ -1310,6 +1312,9 @@ void unlaunch() {
13101312
case ClientGUI.FILE_GAME_QUICK_LOAD:
13111313
quickLoadGame();
13121314
break;
1315+
case ClientGUI.VIEW_NETWORK_INFORMATION:
1316+
showNetworkInformation();
1317+
break;
13131318
case ClientGUI.HELP_ABOUT:
13141319
new CommonAboutDialog(frame).setVisible(true);
13151320
break;
@@ -1343,6 +1348,19 @@ void unlaunch() {
13431348
}
13441349
};
13451350

1351+
private void showNetworkInformation() {
1352+
// Display the network information screen
1353+
getNetworkInformationDialog().refresh();
1354+
getNetworkInformationDialog().pack();
1355+
getNetworkInformationDialog().setVisible(true);
1356+
}
1357+
1358+
public NetworkInformationDialog getNetworkInformationDialog() {
1359+
if (networkInformationDialog == null) {
1360+
networkInformationDialog = new NetworkInformationDialog(this.frame);
1361+
}
1362+
return networkInformationDialog;
1363+
}
13461364
@Override
13471365
public void preferenceChange(PreferenceChangeEvent evt) {
13481366
switch (evt.getName()) {

megamek/src/megamek/client/ui/clientGUI/boardview/CollapseWarning.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@
4040
import megamek.client.ui.clientGUI.GUIPreferences;
4141
import megamek.client.ui.panels.phaseDisplay.DeploymentDisplay;
4242
import megamek.client.ui.panels.phaseDisplay.MovementDisplay;
43+
import megamek.common.Hex;
4344
import megamek.common.board.Board;
4445
import megamek.common.board.BoardLocation;
4546
import megamek.common.board.Coords;
4647
import megamek.common.enums.GamePhase;
4748
import megamek.common.game.Game;
4849
import megamek.common.units.Entity;
4950
import megamek.common.units.IBuilding;
51+
import megamek.common.units.Terrains;
5052
import megamek.logging.MMLogger;
5153

5254
/**
@@ -225,11 +227,14 @@ public static List<Coords> findCFWarningsDeployment(Game game, Entity entity, Bo
225227
* at the hex location that could cause a building to collapse.
226228
*/
227229
public static double calculateTotalTonnage(Game g, Entity selected, Coords c) {
228-
// Calculate total weight of entity and all entities at the location.
230+
Hex hex = g.getBoard().getHex(c);
229231
double totalWeight = selected.getWeight();
230232
List<Entity> units = g.getEntitiesVector(c, true);
231233
for (Entity ent : units) {
232-
if (CollapseWarning.isEntityPartOfWeight(selected, ent)) {
234+
boolean weightCounts = (hex.hasBridge() && isEntityPartOfBridgeWeight(selected, ent,
235+
hex.terrainLevel(Terrains.BRIDGE_ELEV)))
236+
|| (!hex.hasBridge() && isEntityPartOfWeight(selected, ent));
237+
if (weightCounts) {
233238
totalWeight += ent.getWeight();
234239
}
235240
}
@@ -240,6 +245,10 @@ private static boolean isEntityPartOfWeight(Entity selected, Entity inHex) {
240245
return ((selected != inHex) && inHex.isGround() && !inHex.isAirborneVTOLorWIGE());
241246
}
242247

248+
private static boolean isEntityPartOfBridgeWeight(Entity selected, Entity inHex, int bridgeElevation) {
249+
return isEntityPartOfWeight(selected, inHex) && (inHex.getElevation() == bridgeElevation);
250+
}
251+
243252
private CollapseWarning() {
244253
}
245254
}

megamek/src/megamek/client/ui/clientGUI/boardview/overlay/UnitOverviewOverlay.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (C) 2000-2004 Ben Mazur (bmazur@sev.org)
33
* Copyright (C) 2013 Edward Cullen (eddy@obsessedcomputers.co.uk)
4-
* Copyright (C) 2003 The MegaMek Team. All Rights Reserved.
4+
* Copyright (C) 2003, 2026 The MegaMek Team. All Rights Reserved.
55
*
66
* This file is part of MegaMek.
77
*
@@ -34,15 +34,7 @@
3434
*/
3535
package megamek.client.ui.clientGUI.boardview.overlay;
3636

37-
import java.awt.Color;
38-
import java.awt.Dimension;
39-
import java.awt.Font;
40-
import java.awt.FontMetrics;
41-
import java.awt.Graphics;
42-
import java.awt.Image;
43-
import java.awt.Point;
44-
import java.awt.Rectangle;
45-
import java.awt.Toolkit;
37+
import java.awt.*;
4638
import java.util.ArrayList;
4739
import java.util.Vector;
4840

@@ -57,7 +49,6 @@
5749
import megamek.client.ui.widget.picmap.PMUtil;
5850
import megamek.common.Configuration;
5951
import megamek.common.battleArmor.BattleArmor;
60-
import megamek.common.equipment.GunEmplacement;
6152
import megamek.common.equipment.IArmorState;
6253
import megamek.common.game.Game;
6354
import megamek.common.game.GameTurn;
@@ -201,6 +192,7 @@ public void draw(Graphics graph, Rectangle clipBounds) {
201192
drawHeat(graph, e, x, y);
202193
drawConditionStrings(graph, e, x, y);
203194
graph.setColor(getFrameColor(e));
195+
((Graphics2D) graph).setStroke(new BasicStroke(1f));
204196
graph.drawRect(x, y, ICON_WIDTH, ICON_HEIGHT);
205197

206198
Game game = clientgui.getClient().getGame();

0 commit comments

Comments
 (0)