summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-03-29 10:23:35 -0700
committerArun Persaud <arun@nubati.net>2008-03-29 10:23:35 -0700
commitd1e0b371bfc49d0e6a73631621d7881e305f37e3 (patch)
tree93cfdee3d2634510e1cec666bd52106fb2b5e831
parent0593ca8f1fe853e2dd4b4e8d56dbe4ea1a5341be (diff)
downloade-DoKo-d1e0b371bfc49d0e6a73631621d7881e305f37e3.tar.gz
e-DoKo-d1e0b371bfc49d0e6a73631621d7881e305f37e3.tar.bz2
e-DoKo-d1e0b371bfc49d0e6a73631621d7881e305f37e3.zip
BUGFIX: Karlchen and fox weren't accounted for in solos
this made sense in some solos, e.g. trumpless, but not in some other solos, e.g. normal trump solo. Signed-off-by: Arun Persaud <arun@nubati.net>
-rw-r--r--index.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/index.php b/index.php
index f0a434f..f212cf3 100644
--- a/index.php
+++ b/index.php
@@ -1436,7 +1436,20 @@ else if(myisset("me"))
$winner = get_winner($play,$gametype); /* returns the position */
/* check if someone caught a fox */
- if(DB_get_gametype_by_gameid($gameid)!="solo")
+ /* first check if we should account for solos at all,
+ * since it doesn't make sense in some games
+ */
+ $ok = 0; /* fox shouldn't be counted */
+ if(DB_get_gametype_by_gameid($gameid)=="solo")
+ {
+ $solo = DB_get_solo_by_gameid($gameid);
+ if($solo == "trump" || $solo == "silent")
+ $ok = 1; /* for trump solos and silent solos, foxes are ok */
+ }
+ else
+ $ok = 1; /* for all other games (not solos) foxes are ok too */
+
+ if($ok==1)
foreach($play as $played)
{
if ( $played['card']==19 || $played['card']==20 )
@@ -1454,8 +1467,21 @@ else if(myisset("me"))
" VALUES( NULL,NULL,$gameid,'$party1',$uid1,$uid2,'fox')");
}
}
+
/* check for karlchen (jack of clubs in the last trick)*/
- if(DB_get_gametype_by_gameid($gameid)!="solo" && $tricknr == 12)
+ /* 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 */
+ if($tricknr != 12 )
+ $ok = 0; /* Karlchen works only in the last trick */
+ if($ok && DB_get_gametype_by_gameid($gameid)=="solo" )
+ {
+ $solo = DB_get_solo_by_gameid($gameid);
+ if($solo == "trumpless" || $solo == "jack" || $solo == "queen" )
+ $ok = 0; /* no Karlchen in these solos */
+ }
+
+ if($ok)
foreach($play as $played)
if ( $played['card']==11 || $played['card']==12 )
if ($played['pos'] == $winner )