|
@ -97,6 +97,33 @@ public class BShip { |
|
|
grid1 = null; |
|
|
grid1 = null; |
|
|
grid2 = null; |
|
|
grid2 = null; |
|
|
shipsPlaced = false; |
|
|
shipsPlaced = false; |
|
|
|
|
|
|
|
|
|
|
|
//Set new game grid size to selected dimensions. |
|
|
|
|
|
|
|
|
|
|
|
if(a.getSource() == boardSize[0]) { |
|
|
|
|
|
rows = 8; |
|
|
|
|
|
columns = 8; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(a.getSource() == boardSize[1]) { |
|
|
|
|
|
rows = 10; |
|
|
|
|
|
columns = 10; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(a.getSource() == boardSize[2]) { |
|
|
|
|
|
rows = 12; |
|
|
|
|
|
columns = 12; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Determine whether auto placement selected. |
|
|
|
|
|
|
|
|
|
|
|
if(a.getSource() == auto) { |
|
|
|
|
|
autoPlacement = true; |
|
|
|
|
|
} else { |
|
|
|
|
|
autoPlacement = false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startGame(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|