BUGFIX: show "It's your turn in these games" menu also when you played the last card...
authorArun Persaud <arun@nubati.net>
Fri, 5 Mar 2010 03:11:18 +0000 (19:11 -0800)
committerArun Persaud <arun@nubati.net>
Fri, 5 Mar 2010 03:11:18 +0000 (19:11 -0800)
When showing the menu we test for the status the user had before he played the card.

This fixes Issue #35.

include/game.php

index a1c02a0b4f90f4929f6c856254bf3b13ca6a7b30..93ab461415012df85d05094e4f78e5af93a44e1a 100644 (file)
@@ -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