Page 1 of 1
Player tables in same order as player boards?
Posted: 26 December 2014, 04:48
by sparr
I'd like to build my interface with the player table areas in the same order as the player boards. Simply looping through "foreach( $this->game->loadPlayersBasicInfos() as $player_id => $player )" seems to get me an order that's consistent within a game, but random between games. How should I get them in the right order?
Re: Player tables in same order as player boards?
Posted: 29 December 2014, 12:21
by tarini
I forged a custom implementation, maybe it could be useful for you
Code: Select all
function getNaturalOrderedPlayerIdList() {
$activePlayerId = self::getActivePlayerId();
$afterPlayerId = self::getPlayerAfter($activePlayerId);
$toReturn = array($activePlayerId);
while($afterPlayerId != $activePlayerId) {
$toReturn[] = $afterPlayerId;
$afterPlayerId = self::getPlayerAfter($afterPlayerId);
}
return $toReturn;
}
Re: Player tables in same order as player boards?
Posted: 29 December 2014, 18:32
by sparr
This will give me the players in play order. What I'm looking for is the player board order, which is randomly offset.