tReformat code a bit for clarity - hadarawgs - Hadara adaptation for boardgamearena.com
 (HTM) git clone git://git.z3bra.org/hadarawgs.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 050a257d9c925c9fde5909ea42f5d33880eb9ee5
 (DIR) parent c744db10a8c59a62de24720b59957bb8ecaf389f
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Thu,  5 Mar 2020 16:42:24 +0100
       
       Reformat code a bit for clarity
       
       Diffstat:
         M hadarawgs.game.php                  |      16 +++++++++-------
       
       1 file changed, 9 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/hadarawgs.game.php b/hadarawgs.game.php
       t@@ -60,15 +60,11 @@ class hadarawgs extends Table
                */
                protected function setupNewGame( $players, $options = array() )
                {
       -                // Set the colors of the players with HTML color code
       -                // The default below is red/green/blue/orange/brown
       -                // The number of colors defined here must correspond to the maximum number of players allowed for the gams
                        $gameinfos = self::getGameinfos();
                        $default_colors = $gameinfos['player_colors'];
                        $default_animals = $gameinfos['player_animals'];
        
                        // Create players
       -                // Note: if you added some extra field on "player" table in the database (dbmodel.sql), you can initialize it there.
                        $sql = "INSERT INTO player (
                                player_id,
                                player_color,
       t@@ -78,7 +74,13 @@ class hadarawgs extends Table
                        $values = array();
                        foreach( $players as $player_id => $player ) {
                                $color = array_shift( $default_colors );
       -                        $values[] = "('".$player_id."','$color','".$player['player_canal']."','".addslashes( $player['player_name'] )."','".addslashes( $player['player_avatar'] )."')";
       +                        $values[] = "(
       +                                '$player_id',
       +                                '$color',
       +                                '" . $player['player_canal'] ."',
       +                                '" . addslashes( $player['player_name'] ) ."',
       +                                '" . addslashes( $player['player_avatar'] ) ."'
       +                        )";
                        }
                        $sql .= implode( $values, ',' );
                        self::DbQuery( $sql );
       t@@ -110,7 +112,6 @@ class hadarawgs extends Table
                                $coins = $income + $initiative['coins'];
                                $values[] = "($player_id, '$animal', $coins, $income, $military, $culture, $food)";
                        }
       -
                        $sql .= implode( $values, ',' );
                        self::DbQuery( $sql );
        
       t@@ -190,7 +191,8 @@ class hadarawgs extends Table
                        In this space, you can put any utility methods useful for your game logic
                */
        
       -        function getPlayerBoard($player_id) {
       +        function getPlayerBoard($player_id)
       +        {
                        $sql = "SELECT id, animal FROM playerboard where id = $player_id";
                        return self::getCollectionFromDb($sql);
                }