private bool PlaceShip(int row, int col, Ship ship, string direction) { bool checkBoundries = ShipValidations.QuickCheckBounds(row, col, ship, direction, playerShipGrid.BoardSize) == false ? false : true; if (checkBoundries == false) { UI.Error("Not enough room to fit this" + ship.name + " " + ship.size + " spaces " + direction + " of (" + (row) + ", " + (col)); return(false); } else { for (int i = 1; i < ship.size; i++) { bool checkForShips = ShipValidations.QuickCheckEmpty(row, col, i, ship, direction, playerShipGrid.stringGrid) == false ? false : true; if (checkForShips == false) { UI.Error("Not enough room to fit this" + ship.name + " " + ship.size + " spaces " + direction + " of (" + (row) + ", " + (col)); return(false); } } for (int i = 1; i < ship.size; i++) { ShipValidations.NextPosition(row, col, i, ship, direction, playerShipGrid.stringGrid); } playerShipGrid.stringGrid[row, col] = ship.key; } return(true); }
private bool PlaceShip(int row, int col, Ship ship, string direction) { bool checkBoundries = ShipValidations.QuickCheckBounds(row, col, ship, direction, playerShipGrid.BoardSize) == false ? false : true; if (checkBoundries == false) { return(false); } else { for (int i = 1; i < ship.size; i++) { bool checkForShips = ShipValidations.QuickCheckEmpty(row, col, i, ship, direction, playerShipGrid.stringGrid) == false ? false : true; if (checkForShips == false) { return(false); } } for (int i = 1; i < ship.size; i++) { ShipValidations.NextPosition(row, col, i, ship, direction, playerShipGrid.stringGrid); } playerShipGrid.stringGrid[row, col] = ship.key; } return(true); }