Game ".DB_format_gameid($gameid)." has been canceled.
";
+ $messages[] = "Game ".DB_format_gameid($gameid)." has been canceled.";
break;
}
else
@@ -976,11 +1128,12 @@ switch($mystatus)
DB_set_player_by_gameid($gameid,$userid);
DB_set_hand_status_by_hash($userhash,'poverty');
- $message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:".
+ $email_message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:".
" ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ;
- $subject = 'Poverty (game '.DB_format_gameid($gameid).')';
- mymail($userid,$subject,$message);
+ mymail($userid,$gameid, GAME_POVERTY, $email_message);
}
+
+ $cards_status = CARDS_SHOW;
}
else
{
@@ -1053,14 +1206,14 @@ switch($mystatus)
$secondsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid);
$next=1;
- if($firstsick=='poverty')
- if($secondsick=='poverty')
+ if($firstsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump'))
+ if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump'))
$next=3;
else
$next=2;
if($mypos+$next>4)
- echo "If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.";
break;
case 'cancel-timedout':
- echo "
You finished the setup, but not everyone else finished it... ".
- "You need to wait for the others. Just wait for an email.
";
+ $messages[] = _('You finished the setup, but not everyone else finished it... '.
+ 'You need to wait for the others. Just wait for an email.');
- $mycards = DB_get_hand($me);
- $mycards = mysort($mycards,$gametype);
-
- echo "\n";
- echo " Game ".DB_format_gameid($gameid).": \n";
+ echo "\n\n";
/* output vorbehalte */
- $mygametype = DB_get_gametype_by_gameid($gameid);
- if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */
+ $mygametype = DB_get_gametype_by_gameid($gameid);
+ $mygamesolo = DB_get_solo_by_gameid($gameid);
+ $show_pre_game_comments=1;
+ if($mygametype != 'normal') /* only show when needed */
+ if(!( $mygametype == 'solo' && $mygamesolo == 'silent') )
+ {
+ echo "
\n";
+
+ /* get information so show the cards that have been handed over in a poverty game */
+ output_exchanged_cards();
+ $show_pre_game_comments=0;
+
+ echo "
\n"; /* end div trick, end li trick */
+ }
+ if($show_pre_game_comments==1)
{
- echo "
Pre \n".
- " \n";
+ /* display all comments on the top right (card1)*/
+ $comments = DB_get_pre_comment($gameid);
- /* get information so show the cards that have been handed over in a poverty game */
- output_exchanged_cards();
+ if(sizeof($comments))
+ {
+ echo "
\n";
+ /* display card */
+ echo "
\n";
+ /* display comments */
+ foreach( $comments as $comment )
+ echo " \n";
+ echo "
\n"; /* end div card */
- echo "
\n \n"; /* end div trick, end li trick */
+ echo "
\n"; /* end div trick, end li trick */
+ }
}
/* output tricks */
@@ -1276,15 +1426,13 @@ switch($mystatus)
if($trick!=$lasttrick)
{
/* start of an old trick? */
- echo " Trick $trickNR \n".
- " \n".
+ echo "
\n".
"
\n";
}
else if($trick==$lasttrick)
{
/* start of a last trick? */
- echo "
Trick $trickNR \n".
- " \n".
+ echo "
\n".
"
\n";
};
@@ -1295,6 +1443,14 @@ switch($mystatus)
/* display card */
echo "
\n";
+ /* for the first card, we also need to display calls from other players */
+ if($seq==1 && $trickNR==1)
+ {
+ $commentPreCalls=DB_get_pre_comment_call($gameid);
+ foreach ($commentPreCalls as $pre )
+ $comment .= $pre[1].": ".$pre[0]." ";
+ }
+
/* display comments */
if($comment!='')
echo " \n";
@@ -1308,7 +1464,7 @@ switch($mystatus)
if($seq==4)
{
$winner = get_winner($play,$gametype); /* returns the position */
- echo "
\n \n"; /* end div trick, end li trick */
+ echo "
\n"; /* end div trick, end li trick */
}
}
@@ -1377,7 +1533,7 @@ switch($mystatus)
(DB_get_call_by_hash($GAME['schweinchen-who']) || DB_get_partner_call_by_hash($GAME['schweinchen-who']) ))
)
{
- DB_insert_comment('Schweinchen! ',$playid,$myid);
+ DB_insert_comment('Schweinchen! ',$playid,$gameid,$myid);
$commentSchweinchen = 'Schweinchen! ';
}
if ($debug)
@@ -1468,28 +1624,31 @@ switch($mystatus)
/* 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' )
+
+ if($tricknr == 12 ) /* Karlchen works only in the last trick */
{
- $solo = DB_get_solo_by_gameid($gameid);
- if($solo == 'trumpless' || $solo == 'jack' || $solo == 'queen' )
- $ok = 0; /* no Karlchen in these solos */
- }
+ /* check for solo */
+ $solo = 'none';
+ if(DB_get_gametype_by_gameid($gameid)=='solo' )
+ $solo = DB_get_solo_by_gameid($gameid);
- if($ok)
- foreach($play as $played)
- if ( $played['card']==11 || $played['card']==12 )
- if ($played['pos'] == $winner )
- {
- /* possible caught a fox, check party */
- $uid1 = DB_get_userid('gameid-position',$gameid,$winner);
- $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1);
+ /* no Karlchen in these solos */
+ if($solo != 'trumpless' && $solo != 'jack' && $solo != 'queen' )
+ {
+ foreach($play as $played)
+ if ( $played['card']==11 || $played['card']==12 )
+ if ($played['pos'] == $winner )
+ {
+ /* save Karlchen */
+ $uid1 = DB_get_userid('gameid-position',$gameid,$winner);
+ $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1);
+
+ DB_query("INSERT INTO Score".
+ " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')");
+ };
+ };
+ }; /* end scoring Karlchen */
- DB_query("INSERT INTO Score".
- " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')");
- }
/*
* check for doppelopf (>40 points)
***********************************/
@@ -1515,13 +1674,14 @@ switch($mystatus)
if($winner>0)
DB_query("UPDATE Trick SET winner='$winner' WHERE id='$trickid'");
else
- echo "ERROR during scoring";
+ $messages[] = "ERROR during scoring";
if($debug)
echo "DEBUG: position $winner won the trick
";
/* who is the next player? */
$next = $winner;
+ $firstcard = ''; /* unset firstcard, so followsuit doesn't trigger with the last trick */
}
else
{
@@ -1534,17 +1694,18 @@ switch($mystatus)
{
$comment = $_REQUEST['comment'];
if($comment != '')
- DB_insert_comment($comment,$playid,$myid);
+ DB_insert_comment($comment,$playid,$gameid,$myid);
if($commentSchweinchen)
$comment = $commentSchweinchen . $comment;
+ if($commentCall != '')
+ $comment = $commentCall . $comment;
};
/* display played card */
$pos = DB_get_pos_by_hash($me);
if($sequence==1)
{
- echo "
Trick ".($tricknr)." \n".
- " \n".
+ echo "
\n".
"
\n";
}
@@ -1556,7 +1717,7 @@ switch($mystatus)
echo "\n \n";
echo "
\n";
- echo "
\n \n"; /* end div trick, end li trick */
+ echo "
\n"; /* end div trick, end li trick */
/*check if we still have cards left, else set status to gameover */
if(sizeof(DB_get_hand($me))==0)
@@ -1586,13 +1747,12 @@ switch($mystatus)
$who = DB_get_userid('hash',$next_hash);
DB_set_player_by_gameid($gameid,$who);
- $message = "A card has been played in game ".DB_format_gameid($gameid).".\n\n".
+ $email_message = "A card has been played in game ".DB_format_gameid($gameid).".\n\n".
"It's your turn now.\n".
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$next_hash."\n\n" ;
if( DB_get_email_pref_by_uid($who)!='emailaddict' )
{
- $subject = 'A card has been played in game '.DB_format_gameid($gameid);
- mymail($who,$subject,$message);
+ mymail($who,$gameid, GAME_YOUR_TURN, $email_message);
}
}
else /* send out final email */
@@ -1606,10 +1766,10 @@ switch($mystatus)
" LEFT JOIN Card ON Card.id=Hand_Card.card_id".
" WHERE Hand.game_id='$gameid'".
" GROUP BY User.fullname" );
- $message = "The game is over. Thanks for playing :)\n";
- $message .= "Final score:\n";
+ $email_message = "The game is over. Thanks for playing :)\n";
+ $email_message .= "Final score:\n";
while( $r = DB_fetch_array($result) )
- $message .= " ".$r[0]."(".$r[2].") ".$r[1]."\n";
+ $email_message .= " ".$r[0]."(".$r[2].") ".$r[1]."\n";
$result = DB_query("SELECT Hand.party, IFNULL(SUM(Card.points),0) FROM Hand".
" LEFT JOIN Trick ON Trick.winner=Hand.position AND Trick.game_id=Hand.game_id".
@@ -1619,12 +1779,12 @@ switch($mystatus)
" LEFT JOIN Card ON Card.id=Hand_Card.card_id".
" WHERE Hand.game_id='$gameid'".
" GROUP BY Hand.party" );
- $message .= "\nTotals:\n";
+ $email_message .= "\nTotals:\n";
$re = 0;
$contra = 0;
while( $r = DB_fetch_array($result) )
{
- $message .= " ".$r[0]." ".$r[1]."\n";
+ $email_message .= " ".$r[0]." ".$r[1]."\n";
if($r[0] == 're')
$re = $r[1];
else if($r[0] == 'contra')
@@ -1637,8 +1797,8 @@ switch($mystatus)
*/
/* get calls from re/contra */
- $call_re = NULL;
- $call_contra = NULL;
+ $call_re = -1;
+ $call_contra = -1;
foreach($userids as $user)
{
$hash = DB_get_hash_from_gameid_and_userid($gameid,$user);
@@ -1651,14 +1811,14 @@ switch($mystatus)
if($party=='re')
{
- if($call_re==NULL)
+ if($call_re== -1)
$call_re = $call;
else if( $call < $call_re)
$call_re = $call;
}
else if($party=='contra')
{
- if($call_contra==NULL)
+ if($call_contra== -1)
$call_contra = $call;
else if( $call < $call_contra)
$call_contra = $call;
@@ -1669,7 +1829,7 @@ switch($mystatus)
/* figure out who one */
$winning_party = NULL;
- if($call_re == NULL && $call_contra==NULL)
+ if($call_re == -1 && $call_contra == -1)
{
/* nobody made a call, so it's easy to figure out who won */
if($re>120)
@@ -1683,7 +1843,7 @@ switch($mystatus)
* if only one party made a call, the other one wins,
* if the first one didn't make it
*/
- if($call_re)
+ if($call_re != -1)
{
$offset = 120 - $call_re;
if($call_re == 0)
@@ -1691,11 +1851,11 @@ switch($mystatus)
if($re > 120+$offset)
$winning_party='re';
- else if ($call_contra == NULL )
+ else if ($call_contra == -1 )
$winning_party='contra';
}
- if($call_contra)
+ if($call_contra != -1)
{
$offset = 120 - $call_contra;
if($call_contra == 0)
@@ -1703,7 +1863,7 @@ switch($mystatus)
if($contra > 120+$offset)
$winning_party='contra';
- else if ($call_re == NULL )
+ else if ($call_re == -1 )
$winning_party='re';
}
}
@@ -1711,7 +1871,7 @@ switch($mystatus)
/* one point for each call of the other party in case the other party didn't win
* and one point each in case the party made more than points than one of the calls
*/
- if($winning_party!='contra' && $call_contra!=NULL)
+ if($winning_party!='contra' && $call_contra!= -1)
{
for( $p=$call_contra;$p<=120; $p+=30 )
{
@@ -1726,7 +1886,7 @@ switch($mystatus)
" VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'made$p')");
}
}
- if($winning_party!='re' and $call_re!=NULL)
+ if($winning_party!='re' and $call_re!= -1)
{
for( $p=$call_re;$p<=120; $p+=30 )
{
@@ -1755,7 +1915,7 @@ switch($mystatus)
foreach(array(120,150,180,210,240) as $p)
{
$offset = 0;
- if($p==240 || $call_contra!=NULL)
+ if($p==240 || $call_contra != -1)
$offset = 1;
if($re>$p-$offset)
@@ -1765,7 +1925,7 @@ switch($mystatus)
/* re called something and won */
foreach(array(0,30,60,90,120) as $p)
{
- if($call_re!=NULL && $call_re<$p+1)
+ if($call_re!= -1 && $call_re<$p+1)
DB_query("INSERT INTO Score".
" VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'call$p')");
}
@@ -1775,7 +1935,7 @@ switch($mystatus)
foreach(array(120,150,180,210,240) as $p)
{
$offset = 0;
- if($p==240 || $call_re!=NULL)
+ if($p==240 || $call_re != -1)
$offset = 1;
if($contra>$p-$offset)
@@ -1785,7 +1945,7 @@ switch($mystatus)
/* re called something and won */
foreach(array(0,30,60,90,120) as $p)
{
- if($call_contra!=NULL && $call_contra<$p+1)
+ if($call_contra != -1 && $call_contra<$p+1)
DB_query("INSERT INTO Score".
" VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'call$p')");
}
@@ -1793,35 +1953,35 @@ switch($mystatus)
/* add score points to email */
- $message .= "\n";
+ $email_message .= "\n";
$Tpoint = 0;
- $message .= " Points Re: \n";
+ $email_message .= " Points Re: \n";
$queryresult = DB_query("SELECT score FROM Score ".
" WHERE game_id=$gameid AND party='re'".
" ");
while($r = DB_fetch_array($queryresult) )
{
- $message .= " ".$r[0]."\n";
+ $email_message .= " ".$r[0]."\n";
$Tpoint ++;
}
- $message .= " Points Contra: \n";
+ $email_message .= " Points Contra: \n";
$queryresult = DB_query("SELECT score FROM Score ".
" WHERE game_id=$gameid AND party='contra'".
" ");
while($r = DB_fetch_array($queryresult) )
{
- $message .= " ".$r[0]."\n";
+ $email_message .= " ".$r[0]."\n";
$Tpoint --;
}
- $message .= " Total Points (from the Re point of view): $Tpoint\n";
- $message .= "\n";
+ $email_message .= " Total Points (from the Re point of view): $Tpoint\n";
+ $email_message .= "\n";
$session = DB_get_session_by_gameid($gameid);
$score = generate_score_table($session);
- $message .= "Score Table:\n";
- $message .= format_score_table_ascii($score);
- $message .= "\nUse these links to have a look at game ".DB_format_gameid($gameid).": \n";
+ $email_message .= "Score Table:\n";
+ $email_message .= format_score_table_ascii($score);
+ $email_message .= "\nUse these links to have a look at game ".DB_format_gameid($gameid).": \n";
/* send out final email */
foreach($userids as $user)
@@ -1831,31 +1991,29 @@ switch($mystatus)
$name = DB_get_name('userid',$user);
$link = "$name: ".$HOST.$INDEX."?action=game&me=".$hash."\n" ;
- $message .= $link;
+ $email_message .= $link;
}
- $message .= "\n\n (you can use reply all on this email to reach all the players.)\n\n";
- $subject = ' Game over (game '.DB_format_gameid($gameid).') ';
- mymail($userids,$subject,$message);
+ $email_message .= "\n\n (you can use reply all on this email to reach all the players.)\n\n";
+ mymail($userids,$gameid, GAME_OVER, $email_message);
}
}
else
{
- echo "can't find that card?! \n";
+ $messages[] = "can't find that card?!";
}
}
else if(myisset('card') && !$myturn )
{
- echo "please wait until it's your turn! \n";
+ $messages[] = _("please wait until it's your turn!");
}
if($seq!=4 && $trickNR>=1 && !(myisset('card') && $myturn) )
- echo " \n \n"; /* end div trick, end li trick */
+ echo "
\n"; /* end div trick, end li trick */
/* display points in case game is over */
if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' )
{
- echo " Score \n".
- " \n";
+ echo "
\n";
/* add pic for re/contra
"
\n";*/
@@ -1881,118 +2039,54 @@ switch($mystatus)
" LEFT JOIN Card ON Card.id=Hand_Card.card_id".
" WHERE Hand.game_id='$gameid'".
" GROUP BY Hand.party" );
- echo "
\n Totals:
\n";
+ echo "
\n Totals:
\n";
while( $r = DB_fetch_array($result))
- echo " ".$r[0]." ".$r[1]."
\n";
+ echo " ".$r[0]." ".$r[1]."
\n";
$queryresult = DB_query("SELECT timediff(mod_date,create_date) ".
" FROM Game WHERE id='$gameid'");
$r = DB_fetch_array($queryresult);
- echo "
This game took ".$r[0]." hours.
\n";
+ echo "
This game took ".$r[0]." hours.
\n";
- echo "
\n Points Re:
\n";
+ echo "
\n Points Re: \n";
$queryresult = DB_query("SELECT score FROM Score ".
" WHERE game_id=$gameid AND party='re'".
" ");
while($r = DB_fetch_array($queryresult) )
- echo " ".$r[0]." \n";
- echo "
\n";
+ echo " ".$r[0]."
\n";
+ echo "
\n";
- echo "
\n Points Contra:
\n";
+ echo "
\n Points Contra: \n";
$queryresult = DB_query("SELECT score FROM Score ".
" WHERE game_id=$gameid AND party='contra'".
" ");
while($r = DB_fetch_array($queryresult) )
- echo " ".$r[0]." \n";
- echo "
\n";
+ echo " ".$r[0]."
\n";
+ echo "
\n";
- echo "
\n";
+ echo "
\n";
- echo "
\n \n"; /* end div trick, end li trick */
+ echo "
\n"; /* end div trick, end li trick */
}
- echo " prev \n";
- echo "
next \n";
- echo "\n"; /* end ul tricks*/
+ echo "
\n"; /* end ul tricks*/
- $mycards = DB_get_hand($me);
- $mycards = mysort($mycards,$gametype);
- echo "\n";
-
- if($myturn && !myisset('card') && $mystatus=='play' )
+ if( ($myturn && !myisset('card') && $mystatus=='play') /* it's my turn*/
+ || ($myturn && myisset('card') && $next==$mypos && $mystatus=='play') /* a card has been played and player won the trick*/)
{
- echo "Hello ".$myname.", it's your turn! \n";
- echo "Your cards are: \n";
-
- /* do we have to follow suite? */
- $followsuit = 0;
- if(have_suit($mycards,$firstcard))
- $followsuit = 1;
-
- foreach($mycards as $card)
- {
- /* display only cards that the player is allowed to play as links, the rest just display normal
- * also check if we have both schweinchen, in that case only display on of them as playable
- */
- if( ($followsuit && !same_type($card,$firstcard)) ||
- ( (int)($card)==19 &&
- !$GAME['schweinchen-first'] &&
- ( $RULES['schweinchen']=='second' ||
- ( $RULES['schweinchen']=='secondaftercall' &&
- (DB_get_call_by_hash($GAME['schweinchen-who']) ||
- DB_get_partner_call_by_hash($GAME['schweinchen-who']) )
- )
- ) &&
- $GAME['schweinchen-who']==$me &&
- in_array($gametype,array('normal','wedding','trump','silent'))
- )
- )
- display_card($card,$PREF['cardset']);
- else
- display_link_card($card,$PREF['cardset']);
- }
+ $card_status = CARDS_MYTURN;
}
else if($mystatus=='play' )
{
- echo "Your cards are: \n";
- foreach($mycards as $card)
- display_card($card,$PREF['cardset']);
+ $card_status = CARDS_SHOW;
}
else if($mystatus=='gameover')
{
- $oldcards = DB_get_all_hand($me);
- $oldcards = mysort($oldcards,$gametype);
-
if(isset($_SESSION['id']) && $myid==$_SESSION['id'])
- echo "Your cards were: \n";
+ $card_status = CARDS_GAMEOVER_ME;
else
- {
- $name = DB_get_name('userid',$myid);
- echo "$name's were: \n";
- }
-
- foreach($oldcards as $card)
- display_card($card,$PREF['cardset']);
-
- $userids = DB_get_all_userid_by_gameid($gameid);
- foreach($userids as $user)
- {
- $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user);
-
- if($userhash!=$me)
- {
- echo " ";
-
- $name = DB_get_name('userid',$user);
- $oldcards = DB_get_all_hand($userhash);
- $oldcards = mysort($oldcards,$gametype);
- echo "$name's cards were: \n";
- foreach($oldcards as $card)
- display_card($card,$PREF['cardset']);
- }
- };
+ $card_status = CARDS_GAMEOVER;
}
- echo "
\n";
/* if the game is over do some extra stuff, therefore exit the swtich statement if we are still playing*/
if($mystatus=='play')
@@ -2002,69 +2096,235 @@ switch($mystatus)
/* check if game is over, display results */
if(DB_get_game_status_by_gameid($gameid)=='play')
{
- echo "The game is over for you.. other people still need to play though";
+ echo _('The game is over for you... other people still need to play though');
}
break;
default:
myerror("error in testing the status");
- }
+ } /*end of output: tricks, table, messages, card */
+
+/* display the 2nd half of table and the names */
+display_table_end();
+
+/**************
+ * show cards *
+ **************/
+
+$mycards = DB_get_hand($me);
+$mycards = mysort($mycards,$gametype);
+
+echo "\n";
+echo '';
+switch ($card_status) {
+ case CARDS_SHOW:
+ echo _('Your cards are').":
\n";
+ foreach($mycards as $card)
+ display_card($card,$PREF['cardset']);
+ break;
+ case CARDS_EXCHANGE:
+ echo '
'._('You need to get rid of a few cards')."
\n";
+
+ echo _('Your cards are').":
\n";
+ $type='exchange';
+ foreach($mycards as $card)
+ display_link_card($card,$PREF['cardset'],$type);
+ echo '
'."\n";
+ break;
+ case CARDS_MYTURN:
+ echo 'Hello '.$myname.", it's your turn!
\n";
+ echo _('Your cards are').":
\n";
+
+ /* do we have to follow suite? */
+ $followsuit = 0;
+ if(have_suit($mycards,$firstcard))
+ $followsuit = 1;
+
+ /* count how many cards we can play, so that we can pre-select it if there is only one */
+ $howmanycards = 0;
+ foreach($mycards as $card)
+ {
+ if($howmanycards>1)
+ break;
+
+ /* display only cards that the player is allowed to play as links, the rest just display normal
+ * also check if we have both schweinchen, in that case only display on of them as playable
+ */
+ if( ($followsuit && !same_type($card,$firstcard)) ||
+ ( (int)($card)==19 &&
+ !$GAME['schweinchen-first'] &&
+ ( $RULES['schweinchen']=='second' ||
+ ( $RULES['schweinchen']=='secondaftercall' &&
+ (DB_get_call_by_hash($GAME['schweinchen-who']) ||
+ DB_get_partner_call_by_hash($GAME['schweinchen-who']) )
+ )
+ ) &&
+ $GAME['schweinchen-who']==$me &&
+ in_array($gametype,array('normal','wedding','trump','silent'))
+ )
+ )
+ continue;
+ else
+ $howmanycards++;
+ }
+
+ /* make it boolean, so that we can pass it later to display_link_card */
+ if($howmanycards!=1)
+ $howmanycards=0;
+
+ foreach($mycards as $card)
+ {
+ /* display only cards that the player is allowed to play as links, the rest just display normal
+ * also check if we have both schweinchen, in that case only display on of them as playable
+ */
+ if( ($followsuit && !same_type($card,$firstcard)) ||
+ ( (int)($card)==19 &&
+ !$GAME['schweinchen-first'] &&
+ ( $RULES['schweinchen']=='second' ||
+ ( $RULES['schweinchen']=='secondaftercall' &&
+ (DB_get_call_by_hash($GAME['schweinchen-who']) ||
+ DB_get_partner_call_by_hash($GAME['schweinchen-who']) )
+ )
+ ) &&
+ $GAME['schweinchen-who']==$me &&
+ in_array($gametype,array('normal','wedding','trump','silent'))
+ )
+ )
+ display_card($card,$PREF['cardset']);
+ else
+ display_link_card($card,$PREF['cardset'],$type='card',$selected=$howmanycards);
+ }
+ break;
+ case CARDS_GAMEOVER_ME:
+ case CARDS_GAMEOVER:
+ if($card_status == CARDS_GAMEOVER_ME)
+ echo _('Your cards were').":
\n";
+ else
+ {
+ $name = DB_get_name('userid',$myid);
+ echo "$name's were:
\n";
+ }
+ $oldcards = DB_get_all_hand($me);
+ $oldcards = mysort($oldcards,$gametype);
+
+ foreach($oldcards as $card)
+ display_card($card,$PREF['cardset']);
+
+ /* display hands of everyone else */
+ $userids = DB_get_all_userid_by_gameid($gameid);
+ foreach($userids as $user)
+ {
+ $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user);
+
+ if($userhash!=$me)
+ {
+ echo "
";
+
+ $name = DB_get_name('userid',$user);
+ $oldcards = DB_get_all_hand($userhash);
+ $oldcards = mysort($oldcards,$gametype);
+ echo "$name's cards were:
\n";
+ foreach($oldcards as $card)
+ display_card($card,$PREF['cardset']);
+ }
+ };
+ break;
+ case CARDS_EMPTY:
+ default:
+ break;
+ }
+echo "
\n";
-/* 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);
-else if( $mystatus == 'gameover' &&
- isset($_SESSION['id']) )
+/*****************
+ * show messages *
+ *****************/
+
+if( sizeof($messages) )
{
- display_user_menu($_SESSION['id']);
+ echo "\n\n";
+ foreach($messages as $message)
+ {
+ echo "
\n";
+ }
+ echo "
\n\n";
}
-else
+
+/****************************
+ * commit commentCall to DB *
+ ****************************/
+
+if($commentCall != '')
{
- echo "\n";
+ /* treat before game calls special, so that we can show them on the first trick and not the pre-phase */
+ if($playid == -1)
+ $playid = -2;
+
+ DB_insert_comment($commentCall,$playid,$gameid,$myid);
}
+/***********************************************
+ * Comments, re/contra calls, user menu
+ ***********************************************/
+
+/*
+ * display gameinfo: re/contra, comment-box, play-card button, games played by others
+ */
-/* display rule set for this game */
echo "\n";
+echo "\n\n"; /* end gameinfo */
+
+/* make sure that we don't show the notes to the wrong person
+ * (e.g. other people looking at an old game)
+ */
+if( $mystatus != 'gameover' ||
+ ( $mystatus == 'gameover' &&
+ isset($_SESSION['id']) &&
+ $myid == $_SESSION['id']))
+ output_user_notes($myid,$gameid,$mystatus);
echo "