summaryrefslogtreecommitdiffstats
path: root/include/game.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2010-03-04 19:11:18 -0800
committerArun Persaud <arun@nubati.net>2010-03-04 19:11:18 -0800
commitf0e93ad1feb9ba47dc1db80354b5f28d29b5ab27 (patch)
tree396df772c73e0f26357264404758174eec64f70f /include/game.php
parent76ce476d3c48709bf6a69b3cc5bd333c4593d66b (diff)
downloade-DoKo-f0e93ad1feb9ba47dc1db80354b5f28d29b5ab27.tar.gz
e-DoKo-f0e93ad1feb9ba47dc1db80354b5f28d29b5ab27.tar.bz2
e-DoKo-f0e93ad1feb9ba47dc1db80354b5f28d29b5ab27.zip
BUGFIX: show "It's your turn in these games" menu also when you played the last card in a game
When showing the menu we test for the status the user had before he played the card. This fixes Issue #35.
Diffstat (limited to 'include/game.php')
-rw-r--r--include/game.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/game.php b/include/game.php
index a1c02a0..93ab461 100644
--- a/include/game.php
+++ b/include/game.php
@@ -47,6 +47,7 @@ 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);
@@ -2031,11 +2032,20 @@ switch($mystatus)
/* 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( $mystatus != 'gameover' )
- display_user_menu($myid);
+if( $gamestatus != 'gameover' )
+ {
+ /* game isn't over, only valid user can get here, so show menu */
+ display_user_menu($myid);
+ }
+else if( $origmystatus != 'gameover' )
+ {
+ /* user just played the very last card, game is now over, it's still ok to show the menu though */
+ display_user_menu($myid);
+ }
else if( $mystatus == 'gameover' &&
- isset($_SESSION['id']) )
+ isset($_SESSION['id']) )
{
+ /* user is looking at someone else's game, show the menu for the correct user */
display_user_menu($_SESSION['id']);
}
else