From 6d2df49dbf6f6d96f05e35faa68f0a36bd0ff9b5 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Thu, 17 Dec 2015 18:58:48 +0100 Subject: [PATCH] fix php int float comparaison --- src/arenas/Battleship/act.php | 2 +- src/arenas/Battleship/functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index bb6f27d..9ed44b2 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -58,7 +58,7 @@ switch ($_POST['act']){ } if(!is_it_possible_to_place_ships_on_grid($postValues['gridWidth'],$postValues['gridHeight'],$postValues['nbShip1'],$postValues['nbShip2'],$postValues['nbShip3'],$postValues['nbShip4'],$postValues['nbShip5'],$postValues['nbShip6'])){ - error (404,"grid is too little for these sips"); + error (404,"grid is too little for these ships"); } //vars checked, lets init the initGame diff --git a/src/arenas/Battleship/functions.php b/src/arenas/Battleship/functions.php index f41cb26..1500630 100644 --- a/src/arenas/Battleship/functions.php +++ b/src/arenas/Battleship/functions.php @@ -3,7 +3,7 @@ function is_it_possible_to_place_ships_on_grid($gridWidth,$gridHeight,$nbShipsSi //return false or true //not a perfect solution $shipsArea=$nbShipsSize1 + 2 * $nbShipsSize2 + 3 * $nbShipsSize3 + 4 * $nbShipsSize4 + 5 * $nbShipsSize5 + 6 * $nbShipsSize6; - if( $shipsArea < $gridHeight * $gridWidth / 2){ + if( $shipsArea < intval($gridHeight * $gridWidth / 2)){ return false; } //longest ship