Player tables in same order as player boards?

Game development with Board Game Arena Studio
Post Reply
sparr
Posts: 65
Joined: 08 April 2014, 02:12

Player tables in same order as player boards?

Post 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?
User avatar
tarini
Posts: 45
Joined: 11 July 2013, 22:36
Location: italy
Contact:

Re: Player tables in same order as player boards?

Post 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;
    }
sparr
Posts: 65
Joined: 08 April 2014, 02:12

Re: Player tables in same order as player boards?

Post 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.
Post Reply

Return to “Developers”