Skip to content

Commit

Permalink
Merge pull request #3895 from NickAragua/fix_minimap_npe
Browse files Browse the repository at this point in the history
fix #3883
  • Loading branch information
NickAragua authored Sep 11, 2022
2 parents 046a817 + a8227bd commit ced819f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 3 additions & 11 deletions megamek/src/megamek/client/ui/swing/minimap/Minimap.java
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,12 @@ private synchronized void drawMap(boolean forceDraw) {
/** Indicates the deployment hexes. */
private void drawDeploymentZone(Graphics g) {
if ((null != client) && (null != game)
&& (GamePhase.DEPLOYMENT == game.getPhase()) && (dialog != null)) {
&& (GamePhase.DEPLOYMENT == game.getPhase()) && (dialog != null)
&& (bv.getDeployingEntity() != null)) {
GameTurn turn = game.getTurn();
if ((turn != null) && (turn.getPlayerNum() == client.getLocalPlayer().getId())) {
Entity deployingUnit = bv.getDeployingEntity();
int dir;
// We need to draw the same deployment zone as boardview
if ((deployingUnit != null) && (deployingUnit.getOwnerId() == turn.getPlayerNum())) {
dir = deployingUnit.getStartingPos();
} else {
// if we can't get the deploy zone from the
// board view, punt and use the players zone
dir = client.getLocalPlayer().getStartingPos();
}


for (int j = 0; j < board.getWidth(); j++) {
for (int k = 0; k < board.getHeight(); k++) {
Coords coords = new Coords(j, k);
Expand Down
4 changes: 4 additions & 0 deletions megamek/src/megamek/common/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,10 @@ public boolean isLegalDeployment(Coords c, Player p) {
* Can the given entity be deployed at these coordinates
*/
public boolean isLegalDeployment(Coords c, Entity e) {
if (e == null) {
return false;
}

return isLegalDeployment(c, e.getStartingPos(), e.getStartingWidth(), e.getStartingOffset());
}

Expand Down

0 comments on commit ced819f

Please sign in to comment.