X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=cef2c6537c2a11141a38ac387f546943f8624b1b;hp=b8963d2fc5134aac1a1d782a4d4371a82b1b5e3b;hb=e9a0778e2270c200bdb77034a56c7c613606d737;hpb=189a8296e5f6ba47e87167083cff9cb3e1d0d03b diff --git a/include/game.php b/include/game.php index b8963d2..cef2c65 100644 --- a/include/game.php +++ b/include/game.php @@ -49,7 +49,6 @@ global $GAME,$RULES,$CARDS; $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); $mystatus = DB_get_status_by_hash($me); -$origmystatus = DB_get_status_by_hash($me); /* to show "it's your turn" menu when game has just finished */ $mypos = DB_get_pos_by_hash($me); $myhand = DB_get_handid('hash',$me); $myparty = DB_get_party_by_hash($me); @@ -175,6 +174,30 @@ if(myisset('call') && $_REQUEST['call'] == '0' && can_call(0,$me)) } + +/***************************************************************** + * output other games where it is the users turn + * make sure that the people looking at old games don't see the wrong games here + *****************************************************************/ + +if( $gamestatus != 'gameover' && isset($_SESSION['id']) ) + { + /* game isn't over, only valid user can get here, so show menu */ + display_user_menu($myid, $me); + } +else if( $mystatus == 'gameover' && isset($_SESSION['id']) ) + { + /* user is looking at someone else's game, show the menu for the correct user */ + display_user_menu($_SESSION['id'],$me); + } +else + { + echo "
\n"; + echo "It's your turn in these games: \n"; + echo "Please log in to see this information.\n"; + echo "
\n\n"; + } + /***************************************************************** * output extra division in case this game is part of a session *****************************************************************/ @@ -308,6 +331,83 @@ if($mystatus!='gameover') DB_update_user_timestamp($_SESSION['id']); +/****************************************************************************** + * Output menu for selecting tricks + ******************************************************************************/ + +switch($mystatus) + { + case 'start': + break; + case 'init': + case 'check': + /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ + echo "\n\n"; /* end div trick, end li trick , end tricks*/ + /* end displaying sickness */ + break; + case 'poverty': + /* output pre-game trick in case user reloads, + * only needs to be done when a team has been formed */ + if($myparty=='re' || $myparty=='contra') + { + echo "\n\n\n"; /* end div trick, end li trick , end ul tricks */ + } + /* end output pre-game trick */ + break; + case 'play': + case 'gameover': + + echo "\n\n\n"; + + break; + default: + } + + /****************************************************************************** * Output tricks played, table, messages, and cards (depending on game status) ******************************************************************************/ @@ -316,7 +416,68 @@ if($mystatus!='gameover') echo "
\n"; /* display the table and the names */ -display_table(); +display_table_begin(); + + +/****************************** + * Output pre-trick if needed * + ******************************/ + +switch($mystatus) + { + case 'start': + break; + case 'init': + case 'check': + /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ + echo "\n
\n"; + echo "
\n"; + + for($pos=1;$pos<5;$pos++) + { + $usersick = DB_get_sickness_by_pos_and_gameid($pos,$gameid); + $userid = DB_get_userid('gameid-position',$gameid,$pos); + $userstatus = DB_get_hand_status_by_userid_and_gameid($userid,$gameid); + + if($userstatus=='start' || $userstatus=='init') + echo "
still needs
to decide
\n"; /* show this to everyone */ + else + if($usersick!=NULL) /* in the init-phase we only showed players with $pos<$mypos, now we can show all */ + echo "
sick
\n"; + else + echo "
healthy
\n"; + } + echo "
\n
\n"; /* end div trick, end li trick , end tricks*/ + /* end displaying sickness */ + break; + case 'poverty': + /* output pre-game trick in case user reloads, + * only needs to be done when a team has been formed */ + if($myparty=='re' || $myparty=='contra') + { + echo "\n