<?php
-/* make sure that we are not called from outside the scripts,
+/* make sure that we are not called from outside the scripts,
* use a variable defined in config.php to check this
*/
if(!isset($HOST))
DB_close();
exit();
}
-
+
/* user might get here by clicking on the link in an email, so session might not be set */
if(isset($_SESSION["name"]))
output_status($_SESSION["name"]);
$playid = DB_play_card($trickid,$handcardid,$sequence);
- /* check special output for schweinchen in case:
+ /* check special output for schweinchen in case:
* schweinchen is in the rules, a fox has been played and the gametype is correct
*/
- if( $GAME["schweinchen"] &&
- ($card == 19 || $card == 20) &&
+ if( $GAME["schweinchen"] &&
+ ($card == 19 || $card == 20) &&
($gametype == "normal" || $gametype == "silent"|| $gametype=="trump"))
{
$GAME["schweinchen"]++; // count how many have been played including this one
$winner = get_winner($play,$gametype); /* returns the position */
/* check if someone caught a fox */
- /* first check if we should account for solos at all,
+ /* 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 */
}
else
$ok = 1; /* for all other games (not solos) foxes are ok too */
-
+
if($ok==1)
foreach($play as $played)
{
" VALUES( NULL,NULL,$gameid,'$party1',$uid1,$uid2,'fox')");
}
}
-
+
/* 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 */
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 )
$winning_party = NULL;
if($call_re == NULL && $call_contra==NULL)
- if($re>120)
- $winning_party="re";
- else
- $winning_party="contra";
+ {
+ /* nobody made a call, so it's easy to figure out who won */
+ if($re>120)
+ $winning_party="re";
+ else
+ $winning_party="contra";
+ }
else
{
+ /* if one party makes a call, they only win, iff they make enough points
+ * if only one party made a call, the other one wins,
+ * if the first one didn't make it
+ */
if($call_re)
{
$offset = 120 - $call_re;
if($re > 120+$offset)
$winning_party="re";
- else if ( $call_contra == NULL )
+ else if ($call_contra == NULL )
$winning_party="contra";
}
if($contra > 120+$offset)
$winning_party="contra";
- else if ( $call_contra == NULL )
+ else if ($call_re == NULL )
$winning_party="re";
}
}
$score = implode("\n",$score);
$score = $header.$score;
-
+
$message .= "Score Table:\n";
$message .= $score;
echo "$note <hr \>\n";
echo "Insert note:<input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
echo "</div> \n";
-
+
$mycards = DB_get_hand($me);
$mycards = mysort($mycards,$gametype);
echo "<div class=\"mycards\">\n";