diff options
author | Arun Persaud <arun@nubati.net> | 2008-05-15 18:41:08 -0700 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2008-05-15 18:41:08 -0700 |
commit | b5dc679f1b8166fe6d6b37b6b18149700c7cab91 (patch) | |
tree | 87bfa862fff62d80e240493ed29e644cae8a3486 /include | |
parent | 7a18ab2b280a1e009f2e1b2eefb90ba8f7cc5adc (diff) | |
download | e-DoKo-b5dc679f1b8166fe6d6b37b6b18149700c7cab91.tar.gz e-DoKo-b5dc679f1b8166fe6d6b37b6b18149700c7cab91.tar.bz2 e-DoKo-b5dc679f1b8166fe6d6b37b6b18149700c7cab91.zip |
BUGFIX: scoring of silent solo was wrong
game type wasn't set to silent solo. Also needed to change some outputs and other special cases for silent solo
Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/game.php | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/include/game.php b/include/game.php index dcc08c3..d29c2c9 100644 --- a/include/game.php +++ b/include/game.php @@ -530,6 +530,25 @@ switch($mystatus) DB_set_hand_status_by_hash($userhash,'poverty'); } } + /* check for silent solo, set game type to solo in this case */ + $gametype = DB_get_gametype_by_gameid($gameid); + $userids = DB_get_all_userid_by_gameid($gameid); + foreach($userids as $userid) + { + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$userid); + + if($gametype=='normal') + { + $userhand = DB_get_all_hand($userhash); + if(check_wedding($userhand)) + { + /* normal game type and player has both queens -> silent solo */ + /* keep startplayer, just set gametype to silent solo */ + DB_set_gametype_by_gameid($gameid,"solo"); + DB_set_solo_by_gameid($gameid,'silent'); + } + } + } /* send out email to first player or poverty person*/ if($gametype!="poverty" && $gametype!="dpoverty") @@ -840,7 +859,7 @@ switch($mystatus) /* check if all players are ready to play, * if so, send out email to the startplayer - * only need to do this if the game hasn't started yet + * only need to do this if the game hasn't started yet */ $gamestatus = DB_get_game_status_by_gameid($gameid); if($gamestatus == 'pre') @@ -860,14 +879,14 @@ switch($mystatus) { /* only set this after all poverty, etc. are handled*/ DB_set_game_status_by_gameid($gameid,'play'); - + /* email startplayer */ $startplayer = DB_get_startplayer_by_gameid($gameid); $email = DB_get_email('position-gameid',$startplayer,$gameid); $hash = DB_get_hash_from_game_and_pos($gameid,$startplayer); $who = DB_get_userid('email',$email); DB_set_player_by_gameid($gameid,$who); - + if($hash!=$me && DB_get_email_pref_by_hash($hash)!="emailaddict") { /* email startplayer) */ @@ -888,7 +907,10 @@ switch($mystatus) if($gametype=="solo") { $gametype = DB_get_solo_by_gameid($gameid); - $GT = $gametype." ".$GT; + if($gametype=='silent') + $GT = 'normal'; + else + $GT = $gametype." ".$GT; } else $gametype = "normal"; @@ -972,7 +994,7 @@ switch($mystatus) /* output vorbehalte */ $mygametype = DB_get_gametype_by_gameid($gameid); - if($mygametype != "normal") /* only show when needed */ + if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */ { echo " <li onclick=\"hl('0');\" class=\"current\"><a href=\"#\">Pre</a>\n". " <div class=\"trick\" id=\"trick0\">\n"; @@ -1178,7 +1200,7 @@ switch($mystatus) if(DB_get_gametype_by_gameid($gameid)=="solo") { $solo = DB_get_solo_by_gameid($gameid); - if($solo == "trump" || $solo == "silent") + if($solo == 'trump' || $solo == 'silent') $ok = 1; /* for trump solos and silent solos, foxes are ok */ } else @@ -1819,8 +1841,15 @@ switch($mystatus) $type = DB_get_gametype_by_gameid($gameid); if($type=="solo") - output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid); - else + { + $solo = DB_get_solo_by_gameid($gameid); + + if($solo!='silent') /* repeat game with same first player */ + output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid); + else /* rotate normally */ + output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid); + } + else /* rotate normally */ output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid); } } |