diff --git a/countBattles.txt b/countBattles.txt index c7f4ad9..3641460 100755 --- a/countBattles.txt +++ b/countBattles.txt @@ -1 +1 @@ -1662 \ No newline at end of file +1671 \ No newline at end of file diff --git a/src/arenas/tron/TronGame.php b/src/arenas/tron/TronGame.php index c2a1792..bb978d4 100755 --- a/src/arenas/tron/TronGame.php +++ b/src/arenas/tron/TronGame.php @@ -66,9 +66,7 @@ class TronGame save_battle('tron',$winer,$loser,1,'id'); } } - } - public function get_trails(){ //return all trails for draw svg $trailsArr = array(); @@ -109,8 +107,6 @@ class TronGame 'player-index' => $botCount, // To do: verifier que ça restera le même à chaque tour 'players' => $nbeBots ); - //!!!!!!!!!!!!! To debug - //error_log(json_encode($paramsToSend[$botCount])); } } @@ -156,11 +152,21 @@ class TronGame } } - return $this->get_lasts_trails(); - + + //loosers list (in order to pass their id) + $loosersList = array(); + foreach($loosers as $looser){ + $loosersList[] = array( + 'order' => $looser, + 'id' => $this->bots[$looser]->id + ); + } + + return array( + 'last_points' => $this->get_lasts_trails(), + 'loosers' => $loosersList + ); } - - private function get_multi_IAS_Responses($iasUrls, $postParams){ //same as the get_IAS_Responses function // but more than one bot requested parallely diff --git a/src/arenas/tron/act.php b/src/arenas/tron/act.php index f527950..7fffca6 100755 --- a/src/arenas/tron/act.php +++ b/src/arenas/tron/act.php @@ -36,7 +36,7 @@ switch ($_POST['act']){ $botsInfos[] = $botsFullArr[$id]; } } - //************ + $game = new TronGame($botsInfos); diff --git a/src/arenas/tron/js.js b/src/arenas/tron/js.js index 919cf38..9cde497 100755 --- a/src/arenas/tron/js.js +++ b/src/arenas/tron/js.js @@ -100,9 +100,9 @@ function play(gameId,xd_check){ req.onreadystatechange = function(){ if(req.readyState == 4){ if(req.status == 200) { - addLog(req.responseText); + //addLog(req.responseText); var reponse = JSON.parse(req.responseText); - drawMap(reponse['lap']); + drawMap(reponse['lap']['last_points']); if(reponse['continue'] == '1'){ //setTimeout(function(){