Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into clientgui-boardviews-2-mergemaster
Browse files Browse the repository at this point in the history
# Conflicts:
#	megamek/src/megamek/client/ui/swing/ClientGUI.java
#	megamek/src/megamek/common/strategicBattleSystems/SBFGame.java
  • Loading branch information
SJuliez committed May 17, 2024
2 parents e32fc20 + 2d8b33f commit c522a36
Show file tree
Hide file tree
Showing 31 changed files with 545 additions and 466 deletions.
20 changes: 10 additions & 10 deletions megamek/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ sourceSets {
}

dependencies {
implementation 'com.fasterxml.jackson.core:jackson-core:2.14.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.2'
implementation 'com.formdev:flatlaf:3.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0'
implementation 'com.formdev:flatlaf:3.4'
implementation 'com.github.ikkisoft:SerialKiller:master-SNAPSHOT'
implementation 'com.sun.mail:jakarta.mail:2.0.1'
implementation 'com.thoughtworks.xstream:xstream:1.4.20'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'org.freemarker:freemarker:2.3.31'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
implementation 'org.apache.commons:commons-text:1.11.0'
implementation 'org.apache.logging.log4j:log4j-core:2.23.1'
implementation 'org.freemarker:freemarker:2.3.32'

runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:4.0.2'
runtimeOnly 'org.glassfish.jaxb:jaxb-runtime:4.0.5'

testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation 'org.mockito:mockito-core:5.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.mockito:mockito-core:5.11.0'
}

mainClassName = 'megamek.MegaMek'
Expand Down
122 changes: 61 additions & 61 deletions megamek/data/boards/unofficial/Derv_Maps/60x60 Nanking.board
Original file line number Diff line number Diff line change
Expand Up @@ -1766,9 +1766,9 @@ hex 1830 0 "road:1:18" "grass"
hex 1930 0 "road:1:18" "grass"
hex 2030 0 "road:1:18" "grass"
hex 2130 0 "road:1:18" "grass"
hex 2230 0 "" """
hex 2330 0 "" """
hex 2430 0 "" """
hex 2230 0 "" "grass"
hex 2330 0 "" "grass"
hex 2430 0 "" "grass"
hex 2530 0 "woods:1;foliage_elev:2" "grass"
hex 2630 0 "woods:1;foliage_elev:2" "grass"
hex 2730 1 "road:1:36" "grass"
Expand Down Expand Up @@ -1824,13 +1824,13 @@ hex 1631 0 "road:1:27" "grass"
hex 1731 0 "road:1:50" "grass"
hex 1831 0 "road:1:18" "grass"
hex 1931 0 "road:1:18" "grass"
hex 2031 0 "" """
hex 2131 0 "" """
hex 2231 0 "" """
hex 2331 0 "" """
hex 2431 0 "" """
hex 2531 0 "" """
hex 2631 0 "" """
hex 2031 0 "" "grass"
hex 2131 0 "" "grass"
hex 2231 0 "" "grass"
hex 2331 0 "" "grass"
hex 2431 0 "" "grass"
hex 2531 0 "" "grass"
hex 2631 0 "" "grass"
hex 2731 0 "woods:1;foliage_elev:2" "grass"
hex 2831 0 "woods:1;foliage_elev:2" "grass"
hex 2931 1 "road:1:36" "grass"
Expand Down Expand Up @@ -1883,15 +1883,15 @@ hex 1532 0 "road:1:18" "grass"
hex 1632 0 "road:1:19" "grass"
hex 1732 0 "road:1:22" "grass"
hex 1832 0 "road:1:34" "grass"
hex 1932 0 "" """
hex 2032 0 "" """
hex 2132 0 "" """
hex 2232 0 "" """
hex 2332 0 "" """
hex 2432 0 "" """
hex 2532 0 "" """
hex 2632 0 "" """
hex 2732 0 "" """
hex 1932 0 "" "grass"
hex 2032 0 "" "grass"
hex 2132 0 "" "grass"
hex 2232 0 "" "grass"
hex 2332 0 "" "grass"
hex 2432 0 "" "grass"
hex 2532 0 "" "grass"
hex 2632 0 "" "grass"
hex 2732 0 "" "grass"
hex 2832 0 "" "grass"
hex 2932 0 "" "grass"
hex 3032 1 "" "grass"
Expand Down Expand Up @@ -1943,15 +1943,15 @@ hex 1533 0 "road:1:18" "grass"
hex 1633 0 "" "grass"
hex 1733 0 "" "grass"
hex 1833 0 "" "grass"
hex 1933 0 "" """
hex 2033 0 "" """
hex 2133 0 "" """
hex 2233 0 "" """
hex 2333 0 "" """
hex 2433 0 "" """
hex 2533 0 "" """
hex 2633 0 "" """
hex 2733 0 "" """
hex 1933 0 "" "grass"
hex 2033 0 "" "grass"
hex 2133 0 "" "grass"
hex 2233 0 "" "grass"
hex 2333 0 "" "grass"
hex 2433 0 "" "grass"
hex 2533 0 "" "grass"
hex 2633 0 "" "grass"
hex 2733 0 "" "grass"
hex 2833 0 "" "grass"
hex 2933 0 "" "grass"
hex 3033 0 "" "grass"
Expand Down Expand Up @@ -2003,15 +2003,15 @@ hex 1534 0 "" "grass"
hex 1634 0 "" "grass"
hex 1734 0 "" "grass"
hex 1834 0 "" "grass"
hex 1934 0 "" """
hex 2034 0 "" """
hex 2134 0 "" """
hex 2234 0 "" """
hex 2334 0 "" """
hex 2434 0 "" """
hex 2534 0 "" """
hex 2634 0 "" """
hex 2734 0 "" """
hex 1934 0 "" "grass"
hex 2034 0 "" "grass"
hex 2134 0 "" "grass"
hex 2234 0 "" "grass"
hex 2334 0 "" "grass"
hex 2434 0 "" "grass"
hex 2534 0 "" "grass"
hex 2634 0 "" "grass"
hex 2734 0 "" "grass"
hex 2834 0 "" "grass"
hex 2934 0 "" "grass"
hex 3034 0 "" "grass"
Expand Down Expand Up @@ -2063,15 +2063,15 @@ hex 1535 0 "" "grass"
hex 1635 0 "" "grass"
hex 1735 0 "" "grass"
hex 1835 0 "" "grass"
hex 1935 0 "" """
hex 2035 0 "" """
hex 2135 0 "" """
hex 2235 0 "" """
hex 2335 0 "" """
hex 2435 0 "" """
hex 2535 0 "" """
hex 2635 0 "" """
hex 2735 0 "" """
hex 1935 0 "" "grass"
hex 2035 0 "" "grass"
hex 2135 0 "" "grass"
hex 2235 0 "" "grass"
hex 2335 0 "" "grass"
hex 2435 0 "" "grass"
hex 2535 0 "" "grass"
hex 2635 0 "" "grass"
hex 2735 0 "" "grass"
hex 2835 0 "" "grass"
hex 2935 0 "" "grass"
hex 3035 0 "" "grass"
Expand Down Expand Up @@ -2123,15 +2123,15 @@ hex 1536 0 "" "grass"
hex 1636 0 "" "grass"
hex 1736 0 "" "grass"
hex 1836 0 "" "grass"
hex 1936 0 "" """
hex 2036 0 "" """
hex 2136 0 "" """
hex 2236 0 "" """
hex 2336 0 "" """
hex 2436 0 "" """
hex 2536 0 "" """
hex 2636 0 "" """
hex 2736 0 "" """
hex 1936 0 "" "grass"
hex 2036 0 "" "grass"
hex 2136 0 "" "grass"
hex 2236 0 "" "grass"
hex 2336 0 "" "grass"
hex 2436 0 "" "grass"
hex 2536 0 "" "grass"
hex 2636 0 "" "grass"
hex 2736 0 "" "grass"
hex 2836 0 "rough:1" "grass"
hex 2936 0 "" "grass"
hex 3036 1 "" "grass"
Expand Down Expand Up @@ -2185,11 +2185,11 @@ hex 1737 1 "" "grass"
hex 1837 1 "" "grass"
hex 1937 0 "" "grass"
hex 2037 0 "" "grass"
hex 2137 0 "" """
hex 2237 0 "" """
hex 2337 0 "" """
hex 2437 0 "" """
hex 2537 0 "" """
hex 2137 0 "" "grass"
hex 2237 0 "" "grass"
hex 2337 0 "" "grass"
hex 2437 0 "" "grass"
hex 2537 0 "" "grass"
hex 2637 0 "" "grass"
hex 2737 0 "" "grass"
hex 2837 0 "" "grass"
Expand Down Expand Up @@ -2247,7 +2247,7 @@ hex 1938 0 "" "grass"
hex 2038 0 "" "grass"
hex 2138 0 "" "grass"
hex 2238 0 "" "grass"
hex 2338 0 "" """
hex 2338 0 "" "grass"
hex 2438 0 "" "grass"
hex 2538 1 "" "grass"
hex 2638 1 "" "grass"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ anti_air
ISLBXAC2
ISLBXAC2
Searchlight
ISAC2 CL Ammo
ISAC2 CL Ammo
ISAC2 CL Ammo
ISLBXAC2 CL Ammo
ISLBXAC2 CL Ammo
ISLBXAC2 CL Ammo
</Guns Equipment>
13 changes: 11 additions & 2 deletions megamek/docs/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ MEGAMEK VERSION HISTORY:
+ PR #5442: Add null check for turn timer when stopping
+ PR #5451: Expose map settings methods for use in MekHQ
+ Fix #1502: Ignore armortype slots in other-equipment cost calculation


+ PR #5475: Updating Project Dependencies
+ PR #5470: Allow plain look and feel border for Megamek Button
+ PR #5467: Modernize board validity checking code
+ Fix #5465: Bay ammo correction
+ PR #5454: Option to not automatically select a unit for whenever a turn for me comes around
+ Fix #5452: AS advanced search and rear weapon conversion
+ PR #5450: ClientGUI adaptations
+ PR #5448: Adding report processing to SBFGame+Manager, add Report interfaces

0.49.19.1 (2024-05-14 1800 UTC)
+ Milestone Release. Backported fixes.

0.49.19 (2024-04-19 2030 UTC)
+ Fix #5182: Fixes aerospace fighters getting a zero engine rating in TestAero
Expand Down
4 changes: 3 additions & 1 deletion megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1346,8 +1346,10 @@ CommonSettingsDialog.unitTooltipMaxWidth=Max Width for Unit Tooltip
CommonSettingsDialog.unitTooltipMaxWidth.tooltip=keeps tool tip from growing too wide
CommonSettingsDialog.useAverageSkills=Use the current random skill settings when adding units in the lobby.
CommonSettingsDialog.useGPinUnitSelection=Display Gunnery and Piloting in Unit Selection screen for BV/PV
CommonSettingsDialog.useAutoCenter.tooltip=User initiated centering still applies
CommonSettingsDialog.useAutoCenter=Use automatic unit centering on the board
CommonSettingsDialog.useAutoCenter.tooltip=User initiated centering still applies
CommonSettingsDialog.useAutoSelectNext=Auto-select your units at turn start
CommonSettingsDialog.useAutoSelectNext.tooltip=Automatically selects the first valid of your units whenever one of your turns starts, centering the map on it when auto-centering is activated
CommonSettingsDialog.useCamoOverlay=Use Camo Overlay
CommonSettingsDialog.useInclines=Show incline highlighting and shadows at hex borders
CommonSettingsDialog.useShadowMap=Show terrain, building and unit sprite shadows
Expand Down
21 changes: 10 additions & 11 deletions megamek/src/megamek/client/ui/swing/BoardEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1735,23 +1735,23 @@ private void setupUiFreshBoard() {
* be shown.
*/
private void validateBoard(boolean showPositiveResult) {
StringBuffer errBuff = new StringBuffer();
board.isValid(errBuff);
if ((errBuff.length() > 0) || showPositiveResult) {
showBoardValidationReport(errBuff);
List<String> errors = new ArrayList<>();
board.isValid(errors);
if ((!errors.isEmpty()) || showPositiveResult) {
showBoardValidationReport(errors);
}
}

/**
* Shows a board validation report dialog, reporting either
* the contents of errBuff or that the board has no errors.
*/
private void showBoardValidationReport(StringBuffer errBuff) {
private void showBoardValidationReport(List<String> errors) {
ignoreHotKeys = true;
if ((errBuff != null) && errBuff.length() > 0) {
if ((errors != null) && !errors.isEmpty()) {
String title = Messages.getString("BoardEditor.invalidBoard.title");
String msg = Messages.getString("BoardEditor.invalidBoard.report");
msg += errBuff;
msg += String.join("\n", errors);
JTextArea textArea = new JTextArea(msg);
JScrollPane scrollPane = new JScrollPane(textArea);
textArea.setLineWrap(true);
Expand Down Expand Up @@ -2315,11 +2315,10 @@ public void paintComponent(Graphics g) {
g.setColor(getForeground());
g.setFont(new Font(MMConstants.FONT_SANS_SERIF, Font.PLAIN, 9));
g.drawString(Messages.getString("BoardEditor.LEVEL") + curHex.getLevel(), 24, 70);
StringBuffer errBuf = new StringBuffer();
if (!curHex.isValid(errBuf)) {
List<String> errors = new ArrayList<>();
if (!curHex.isValid(errors)) {
invalidString.draw(g);
String tooltip = Messages.getString("BoardEditor.invalidHex") + errBuf;
tooltip = tooltip.replace("\n", "<br>");
String tooltip = Messages.getString("BoardEditor.invalidHex") + String.join("<BR>", errors);
setToolTipText(tooltip);
} else {
setToolTipText(null);
Expand Down
27 changes: 22 additions & 5 deletions megamek/src/megamek/client/ui/swing/ClientGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@

public class ClientGUI extends AbstractClientGUI implements BoardViewListener,
ActionListener, IPreferenceChangeListener, MechDisplayListener {

// region Variable Declarations
public static final int WEAPON_NONE = -1;

Expand Down Expand Up @@ -351,15 +350,17 @@ public class ClientGUI extends AbstractClientGUI implements BoardViewListener,
* clean up after itself as much as possible, but will not call
* System.exit().
*/
public ClientGUI(Client client, MegaMekController c) {
super(client);
this.client = client;
public ClientGUI(IClient client, MegaMekController c) {
if (!(client instanceof Client)) {
throw new IllegalArgumentException("TW ClientGUI must use TW Client!");
}
this.client = (Client) client;
controller = c;
panMain.setLayout(cardsMain);
panSecondary.setLayout(cardsSecondary);

clientGuiPanel.setLayout(new BorderLayout());
clientGuiPanel.addComponentListener(resizeListener);
clientGuiPanel.addComponentListener(this);
clientGuiPanel.add(panMain, BorderLayout.CENTER);
clientGuiPanel.add(panSecondary, BorderLayout.SOUTH);

Expand Down Expand Up @@ -454,6 +455,16 @@ public void systemMessage(String message) {
cb2.addChatMessage(Messages.getString("ChatterBox.MegaMek") + " " + message);
}

/**
* Initializes a number of things about this frame.
*/
@Override
protected void initializeFrame() {
super.initializeFrame();
menuBar = CommonMenuBar.getMenuBarForGame();
frame.setJMenuBar(menuBar);
}

/**
* Lays out the frame by setting this Client object to take up the full
* frame display area.
Expand Down Expand Up @@ -535,6 +546,11 @@ public void initialize() {
layoutFrame();
menuBar.addActionListener(this);

cb2 = new ChatterBox2(this, bv, controller);
bv.addOverlay(cb2);
bv.getPanel().addKeyListener(cb2);
offBoardOverlay = new OffBoardTargetOverlay(this);

aw = new AccessibilityWindow(this);
aw.setLocation(0, 0);
aw.setSize(300, 300);
Expand Down Expand Up @@ -1934,6 +1950,7 @@ protected void loadListFile(Player player, boolean reinforce) {
}
}

@Override
public boolean saveGame() {
ignoreHotKeys = true;
JFileChooser fc = new JFileChooser(MMConstants.SAVEGAME_DIR);
Expand Down
Loading

0 comments on commit c522a36

Please sign in to comment.