case ship outside map
This commit is contained in:
parent
254fd4e077
commit
deb74b073e
|
@ -99,8 +99,8 @@ switch ($_POST['act']){
|
||||||
}
|
}
|
||||||
|
|
||||||
//init grid
|
//init grid
|
||||||
for($y = 0; $y < $height; $y++){
|
for($y = 0; $y < $postValues['gridHeight']; $y++){
|
||||||
for($x = 0; $x < $width; $x++){
|
for($x = 0; $x < $postValues['gridWidth']; $x++){
|
||||||
$grid[$player][$y][$x]=0;
|
$grid[$player][$y][$x]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,13 @@ function get_IA_Response($iaUrl,$postParams){
|
||||||
return htmlentities($output);
|
return htmlentities($output);
|
||||||
}
|
}
|
||||||
function place_ship_on_map($x1,$y1,$x2,$y2,$map){
|
function place_ship_on_map($x1,$y1,$x2,$y2,$map){
|
||||||
if (($x1 <> $x2) && ($y1 <> $y2)){
|
if ((($x1 <> $x2) && ($y1 <> $y2))
|
||||||
return false;
|
OR (!isset($map[$y1][$x1]))
|
||||||
|
OR (!isset($map[$y2][$x2]))){
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($x1 == $x2){
|
if($x1 == $x2){
|
||||||
//horizontal ship
|
//horizontal ship
|
||||||
if($y1 <= $y2 ){
|
if($y1 <= $y2 ){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user