Skip to content

Commit

Permalink
can't upgrade nonexistent tower
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Gonzalez Hermosillo committed Jan 3, 2025
1 parent 024c428 commit 29d31b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions engine/src/main/battlecode/world/RobotControllerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ private void assertCanUpgradeTower(MapLocation loc) throws GameActionException{
assertCanActLocation(loc, GameConstants.BUILD_TOWER_RADIUS_SQUARED);
InternalRobot robot = this.gameWorld.getRobot(loc);

if (robot == null){
throw new GameActionException(CANT_DO_THAT, "There is no robot at the location");
}
if (!this.robot.getType().isTowerType()){
throw new GameActionException(CANT_DO_THAT, "No tower at the location");
}
Expand Down

0 comments on commit 29d31b9

Please sign in to comment.