From e2d7a3291f85403b4faf6f8be7e30caeefb0c1a3 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Tue, 2 Feb 2010 20:19:43 -0800 Subject: highlight the call if this is the last round where you can make this call also added some more comments --- include/game.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include/game.php') diff --git a/include/game.php b/include/game.php index 30abe7d..de19cab 100644 --- a/include/game.php +++ b/include/game.php @@ -1420,7 +1420,10 @@ switch($mystatus) $play = DB_get_cards_by_trick($trickid); $winner = get_winner($play,$gametype); /* returns the position */ - /* check if someone caught a fox */ + /* + * check if someone caught a fox + *******************************/ + /* first check if we should account for solos at all, * since it doesn't make sense in some games */ @@ -1453,7 +1456,10 @@ switch($mystatus) } } - /* check for karlchen (jack of clubs in the last trick)*/ + /* + * check for karlchen (jack of clubs in the last trick) + ******************************************************/ + /* same as for foxes, karlchen doesn't always make sense * check what kind of game it is and set karlchen accordingly */ $ok = 1; /* default: karlchen should be accounted for */ @@ -1478,7 +1484,10 @@ switch($mystatus) DB_query("INSERT INTO Score". " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); } - /* check for doppelopf (>40 points)*/ + /* + * check for doppelopf (>40 points) + ***********************************/ + $points = 0; foreach($play as $played) { @@ -1493,6 +1502,10 @@ switch($mystatus) " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'doko')"); } + /* + * set winner (for this trick) + */ + if($winner>0) DB_query("UPDATE Trick SET winner='$winner' WHERE id='$trickid'"); else -- cgit v1.2.3-18-g5258 From 3851854ad07430dc62337d482e811bf9363480a5 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 4 Feb 2010 20:19:18 -0800 Subject: BUGFIX: timestamp was not always updated when user made a move this happend when the user wasn't logged in, but made a move by using an email link for example. Should be fixed now. --- include/game.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include/game.php') diff --git a/include/game.php b/include/game.php index de19cab..0a40bab 100644 --- a/include/game.php +++ b/include/game.php @@ -24,10 +24,6 @@ if(!$myid) global $GAME,$RULES,$CARDS; -/* the user has done something, update the timestamp */ -if(isset($_SESSION['id'])) - DB_update_user_timestamp($_SESSION['id']); - /* get some information from the DB */ $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); @@ -288,6 +284,16 @@ display_table(); * play: game in progress * gameover: are we revisiting a game */ + +/* the user has done something, update the timestamp. Use $myid in + * active games and check for session-id in old games (myid might be wrong in that case) + */ +if($mystatus!='gameover') + DB_update_user_timestamp($myid); + else + if(isset($_SESSION['id'])) + DB_update_user_timestamp($_SESSION['id']); + switch($mystatus) { case 'start': -- cgit v1.2.3-18-g5258 From 3b407a98fe0243cef87fdd64aeb4f567cca41f40 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 4 Feb 2010 20:25:16 -0800 Subject: BUGFIX: show correct name of all players, when looking at games of other players the name of the player who had the same cards wasn't displayed, instead "your cards where" was shown. --- include/game.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/game.php') diff --git a/include/game.php b/include/game.php index 0a40bab..e20ea9a 100644 --- a/include/game.php +++ b/include/game.php @@ -1962,7 +1962,15 @@ switch($mystatus) { $oldcards = DB_get_all_hand($me); $oldcards = mysort($oldcards,$gametype); - echo "Your cards were:
\n"; + + if(isset($_SESSION['id']) && $myid==$_SESSION['id']) + echo "Your cards were:
\n"; + else + { + $name = DB_get_name('userid',$myid); + echo "$name's were:
\n"; + } + foreach($oldcards as $card) display_card($card,$PREF['cardset']); -- cgit v1.2.3-18-g5258