Skip to content

Commit

Permalink
Merge pull request #4168 from kuronekochomusuke/mapSize
Browse files Browse the repository at this point in the history
show map size on mini map
  • Loading branch information
SJuliez authored Feb 16, 2023
2 parents 47fce6a + e443451 commit 72c0dad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,7 @@ Minimap.BuildingHeightLabel=B
Minimap.GroundHeightLabel=G
Minimap.NoHeightLabel=N
Minimap.TotalHeightLabel=T
Minimap.X=X

#Mini round report display
MiniReportDisplay.Damage=Damage
Expand Down
22 changes: 17 additions & 5 deletions megamek/src/megamek/client/ui/swing/minimap/Minimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
import java.util.List;
import java.util.*;

import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_BASERECT;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_CX;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.STRAT_SYMBOLSIZE;
import static megamek.client.ui.swing.minimap.MinimapUnitSymbols.*;
import static megamek.common.Terrains.*;

/**
Expand Down Expand Up @@ -711,7 +709,20 @@ private void drawButtons(Graphics g) {
default:
label = "";
}
g.drawString(label, 17, y0 + 12);
g.drawString(label, 17, y0 + 11);

// map size
int width = getFontMetrics(g.getFont()).stringWidth(label);
String mapSize = board.getWidth() + " " + Messages.getString("Minimap.X") + " " + board.getHeight();
int x = 24 + width;
g.drawString(mapSize, x, y0 + 11);
width = getFontMetrics(g.getFont()).stringWidth(mapSize);
x += width + 3;
g.setColor(Color.black);
g.drawLine(x, y0, x, h);
x += 1;
g.setColor(Color.green.darker());
g.drawLine(x, y0, x, h);
}
}
}
Expand All @@ -731,10 +742,11 @@ private void paintHeight(Graphics g, Hex h, int x, int y) {
height = (h.containsAnyTerrainOf(BUILDING, FUEL_TANK)) ? h.ceiling() : h.floor();
}
if (height != 0) {
String sHeight = ((height > -1) && (height < 10)) ? " " + height : height + "";
int baseX = (x * (HEX_SIDE[zoom] + HEX_SIDE_BY_SIN30[zoom])) + leftMargin;
int baseY = (((2 * y) + 1 + (x % 2)) * HEX_SIDE_BY_COS30[zoom]) + topMargin;
g.setColor(Color.white);
g.drawString(height + "", baseX + 5, baseY + 5);
g.drawString(sHeight, baseX + 5, baseY + 5);
}
}

Expand Down

0 comments on commit 72c0dad

Please sign in to comment.