Skip to content

Commit ac1bdc2

Browse files
authored
Merge branch 'main' into silverbullet_hitmod
2 parents 500ffc7 + 0eee9b5 commit ac1bdc2

File tree

38 files changed

+603
-174
lines changed

38 files changed

+603
-174
lines changed

.github/workflows/checkstyle.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ main ]
66

77
jobs:
8-
pr_build:
8+
checkstyle:
99
runs-on: ${{ matrix.os }}
1010

1111
strategy:
@@ -27,12 +27,18 @@ jobs:
2727
with:
2828
path: megamek
2929

30+
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
31+
uses: actions/setup-java@v5
32+
with:
33+
distribution: ${{ matrix.java-distribution }}
34+
java-version: ${{ matrix.java-version }}
35+
3036
- name: Setup Gradle
3137
uses: gradle/actions/setup-gradle@v5
3238

3339
- name: Checkstyle
3440
working-directory: megamek
35-
run: ./gradlew checkstyleMain
41+
run: ./gradlew checkstyleMain checkstyleTest
3642

3743
- name: Upload Test Logs on Failure
3844
uses: actions/upload-artifact@v6

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: Test
5656
working-directory: megamek
57-
run: ./gradlew test
57+
run: ./gradlew test -x checkstyleMain -x checkstyleTest
5858

5959
- name: Upload Test Logs on Failure
6060
uses: actions/upload-artifact@v6
@@ -72,7 +72,7 @@ jobs:
7272

7373
- name: Build with Gradle
7474
working-directory: megamek
75-
run: ./gradlew build -x test -PextraVersion="PR-${{ github.event.number }}-${{ env.COMMIT_SHORT_SHA }}"
75+
run: ./gradlew build -x test -x checkstyleMain -x checkstyleTest -PextraVersion="PR-${{ github.event.number}}-${{ env.COMMIT_SHORT_SHA }}"
7676

7777
- name: Upload TarGZ Release
7878
uses: actions/upload-artifact@v6

.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/**

config/checkstyle/checkstyle.xml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
<property name="file" value="${suppressionFile}" />
99
</module>
1010

11-
<module name="RegexpSingleline">
12-
<property name="format" value="^(?!.*(bg\.battletech|MechWarrior Copyright|MechWarrior, BattleMech, `Mech and AeroTech are registered trademarks|BattleMech Manual)).*\b(?i)(mech|mechwarrior|battlemech|aerotech|protomech|'mech|`Mech|TripodMech|BipedMech|QuadMech|LandAirMech|OmniMech|'Mechs)\b.*$" />
13-
<property name="ignoreCase" value="true" />
14-
<property name="message" value="Forbidden word found" />
15-
<property name="fileExtensions" value="properties, md" />
16-
<property name="severity" value="error" />
11+
<module name="SuppressWithNearbyTextFilter">
12+
<property name="nearbyTextPattern" value="CHECKSTYLE IGNORE ForbiddenWords FOR (\d+) LINES" />
13+
<property name="lineRange" value="$1" />
14+
<property name="idPattern" value="ForbiddenWords" />
1715
</module>
1816

1917
<!-- Check that "license" appears at least once in the file -->
@@ -24,21 +22,29 @@
2422
<property name="ignoreCase" value="true" />
2523
<property name="message" value="File must contain a license header" />
2624
<property name="severity" value="error" />
27-
<property name="fileExtensions" value="java" />
25+
</module>
26+
27+
<module name="RegexpSingleline">
28+
<property name="id" value="ForbiddenWords" />
29+
<property name="format" value="^(?!.*(bg\.battletech|MechWarrior Copyright|MechWarrior, BattleMech, `Mech and AeroTech are registered trademarks|BattleMech Manual)).*\b(?i)(mech|mechwarrior|battlemech|aerotech|protomech|'mech|`Mech|TripodMech|BipedMech|QuadMech|LandAirMech|OmniMech|'Mechs)\b.*$" />
30+
<property name="ignoreCase" value="true" />
31+
<property name="message" value="Forbidden word found" />
32+
<property name="severity" value="error" />
2833
</module>
2934

3035
<module name="TreeWalker">
3136
<module name="SuppressWithNearbyCommentFilter">
3237
<property name="commentFormat" value="CHECKSTYLE IGNORE ForbiddenWords FOR (\d+) LINES" />
3338
<property name="checkFormat" value=".*" />
3439
<property name="influenceFormat" value="$1" />
40+
<property name="idFormat" value="ForbiddenWords" />
3541
</module>
3642

3743
<module name="SuppressionCommentFilter" />
3844

3945
<module name="RegexpSinglelineJava">
4046
<property name="id" value="ForbiddenWords" />
41-
<property name="format" value="^(?!.*(bg\.battletech|MechWarrior Copyright|MechWarrior, BattleMech, `Mech and AeroTech are registered trademarks)).*\b(?i)(mech|mechwarrior|battlemech|aerotech|protomech|'mech|`Mech|TripodMech|BipedMech|QuadMech|LandAirMech|OmniMech|Mechs)\b.*$" />
47+
<property name="format" value="^(?!.*(bg\.battletech|MechWarrior Copyright|MechWarrior, BattleMech, `Mech and AeroTech are registered trademarks|BattleMech Manual)).*\b(?i)(mech|mechwarrior|battlemech|aerotech|protomech|'mech|`Mech|TripodMech|BipedMech|QuadMech|LandAirMech|OmniMech|'Mechs)\b.*$" />
4248
<property name="ignoreCase" value="true" />
4349
<property name="ignoreComments" value="false" />
4450
<property name="message" value="Forbidden word found" />

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/bot/BotClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void gameClientFeedbackRequest(GameCFREvent evt) {
219219
// Picks the WAA with the highest expected damage,
220220
// essentially same as if the auto_ams option was on
221221
waa = Compute.getHighestExpectedDamage(game, evt.getWAAs(), true);
222-
222+
223223
// Add second weapon attack counter for the bot when playtest 3 is active
224224
WeaponAttackAction secondWaa = null;
225225
if (game.getOptions().booleanOption(OptionsConstants.PLAYTEST_3)) {
@@ -236,7 +236,7 @@ public void gameClientFeedbackRequest(GameCFREvent evt) {
236236
if (numInts == 2) {
237237
indexes[1] = evt.getWAAs().indexOf(secondWaa);
238238
}
239-
239+
240240
sendAMSAssignCFRResponse(indexes);
241241
break;
242242
case CFR_APDS_ASSIGN:
@@ -1336,6 +1336,7 @@ private void resetMinefieldCounters() {
13361336
getLocalPlayer().setNbrMFConventional(0);
13371337
getLocalPlayer().setNbrMFInferno(0);
13381338
getLocalPlayer().setNbrMFVibra(0);
1339+
getLocalPlayer().setNbrMFEMP(0);
13391340
sendPlayerInfo();
13401341
}
13411342

@@ -1374,10 +1375,11 @@ private MinefieldNumbers[] getMinefieldNumbers() {
13741375
Minefield.TYPE_CONVENTIONAL),
13751376
new MinefieldNumbers(getLocalPlayer().getNbrMFVibra(),
13761377
Minefield.TYPE_VIBRABOMB),
1378+
new MinefieldNumbers(getLocalPlayer().getNbrMFEMP(),
1379+
Minefield.TYPE_EMP),
13771380
// the following are added for completeness, but are not used by the bot
13781381
new MinefieldNumbers(0, Minefield.TYPE_COMMAND_DETONATED),
13791382
// no command detonated mines
1380-
new MinefieldNumbers(0, Minefield.TYPE_EMP), // no field for EMP mines exists
13811383
};
13821384
}
13831385

megamek/src/megamek/client/bot/princess/Princess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2740,7 +2740,7 @@ protected void initMovement() {
27402740
}
27412741

27422742
if (isEnemyBuildingEntity(entity, coords)) {
2743-
fireControlState.getAdditionalTargets().add(bt);
2743+
fireControlState.addAdditionalTarget(bt);
27442744
sendChat("Building in Hex " +
27452745
coords.toFriendlyString() +
27462746
" designated target due to Building Entity.", Level.INFO);

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;

0 commit comments

Comments
 (0)