diff --git a/src/arenas/tron/act.php b/src/arenas/tron/act.php index e825e0c..3a7e539 100644 --- a/src/arenas/tron/act.php +++ b/src/arenas/tron/act.php @@ -11,9 +11,35 @@ # -- END LICENSE BLOCK ----------------------------------------- require_once(__DIR__."/functions.php"); + + switch ($_POST['act']){ case "initGame": + //check if bots exists + $bots=get_Bots_Array('tron'); + + $bot1Exists = false; + $bot2Exists = false; + foreach($bots as $bot){ + if($bot['id'] == $_POST['bot1']){ + $_SESSION['bots'][]=new TronPlayer($bot['id']); + $bot1Exists =true; + } + if($bot['id'] == $_POST['bot2']){ + $_SESSION['bots'][]=new TronPlayer($bot['id']); + $bot2Exists =true; + } + if ($bot1Exists && $bot2Exists){ + break; + } + } + if ((!$bot1Exists) OR (!$bot2Exists)){ + error (500,"missing parameter 2"); + } + + echo "plop"; + break; default: