From d3841fcbcb98f5e2bbdeb7b89733b8757e848f20 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 2 May 2013 21:19:21 -0700 Subject: CLEANUP: GT,gametype,mygametype variable, make it translatable, some code cleanup --- include/game.php | 117 ++++++++++++++++++++++++------------------------------- 1 file changed, 51 insertions(+), 66 deletions(-) (limited to 'include/game.php') diff --git a/include/game.php b/include/game.php index 38cf7e3..541c70a 100644 --- a/include/game.php +++ b/include/game.php @@ -65,17 +65,20 @@ set_language($PREF['language']); $RULES = DB_get_RULES($gameid); /* get some infos about the game */ -$gametype = DB_get_gametype_by_gameid($gameid); -$gamestatus = DB_get_game_status_by_gameid($gameid); -$GT = $gametype; -if($gametype=='solo') - { - $gametype = DB_get_solo_by_gameid($gameid); - if($gametype=='silent') - $GT = 'normal'; - else - $GT = $gametype.' '.$GT; - } +$gametype_raw = DB_get_gametype_by_gameid($gameid); +$gametype_solo = DB_get_solo_by_gameid($gameid); + +/* replace solo with the type of solo */ +$gametype = $gametype_raw; +if($gametype_raw=='solo') + $gametype = $gametype_solo; + +/* gametype for displaying it (hides hidden solo)*/ +$GT = get_display_gametype($gameid); + +$gamestatus = DB_get_game_status_by_gameid($gameid); + + /* do we need to worry about Schweinchen? * check gametype and rules @@ -279,7 +282,7 @@ if($session) $score = generate_score_table($session); /* get the last entry to show on the main page */ - $tmpscore= $score; + $tmpscore = $score; $finalscore = array_pop($tmpscore); $finalscore = $finalscore['players']; @@ -306,7 +309,7 @@ if($session) * previous and next game if possible */ $hashes = DB_get_hashes_by_session($session,$myid); - $next = NULL; + $next = NULL; $i = 1; foreach($hashes as $hash) { @@ -328,8 +331,11 @@ if($session) /* check for solo, add game type to session number */ echo ' '._('Game')." $session.$j"; - if($gamestatus != 'pre' && $GT !='normal' ) - echo " ($GT)"; + if($gamestatus != 'pre') + if($gametype_raw != 'normal') /* only show when needed */ + if(!($gametype_raw == 'solo' && $gametyep_solo == 'silent') ) + echo " ($GT)"; + if(isset($_SESSION['id']) && $_SESSION['id']==$myid) { if($previous) @@ -377,9 +383,6 @@ switch($mystatus) if($myparty=='re' || $myparty=='contra') { echo "\n\n\n"; /* end div trick, end li trick , end ul tricks */ } @@ -391,15 +394,13 @@ switch($mystatus) echo "\n