Skip to content

Commit

Permalink
Clean up getHex() check and remove extraneous block
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleet01 committed Jan 13, 2025
1 parent 3533e20 commit e20bf40
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions megamek/src/megamek/server/totalwarfare/TWGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7125,7 +7125,7 @@ private boolean enterMinefield(Entity entity, Coords c, int curElev, boolean isO
try {
// if we are in the water, then the sea mine will only blow up if at
// the right depth
if (game.getBoard().contains(mf.getCoords()) &&
if (game.getBoard().getHex(mf.getCoords()) != null &&
game.getBoard().getHex(mf.getCoords()).containsTerrain(Terrains.WATER)
) {
if ((Math.abs(curElev) != mf.getDepth())
Expand Down Expand Up @@ -7604,15 +7604,9 @@ boolean checkVibrabombs(Entity entity, Coords coords, boolean displaced, Coords
Minefield mf = e.nextElement();

try {
// Safety check; can't operate on minefields that don't officially exist
if (game.getBoard().getHex(mf.getCoords()) == null) {
logger.warn("Minefield not found on board: " + mf.toString());
continue;
}

// Bug 954272: Mines shouldn't work underwater, and BMRr says
// Vibrabombs are mines
if (game.getBoard().contains(mf.getCoords()) &&
if (game.getBoard().getHex(mf.getCoords()) != null &&
game.getBoard().getHex(mf.getCoords()).containsTerrain(Terrains.WATER)
&& !game.getBoard().getHex(mf.getCoords()).containsTerrain(Terrains.PAVEMENT)
&& !game.getBoard().getHex(mf.getCoords()).containsTerrain(Terrains.ICE)) {
Expand Down

0 comments on commit e20bf40

Please sign in to comment.