+display_table_end();
+
+/**************
+ * show cards *
+ **************/
+
+$mycards = DB_get_hand($me);
+$mycards = mysort($mycards,$gametype);
+
+echo "\n";
+echo '<div class="mycards">';
+switch ($card_status) {
+ case CARDS_SHOW:
+ echo _('Your cards are').": <br />\n";
+ foreach($mycards as $card)
+ display_card($card,$PREF['cardset']);
+ break;
+ case CARDS_EXCHANGE:
+ echo '<div class="poverty"> '._('You need to get rid of a few cards')."</div>\n";
+
+ echo _('Your cards are').": <br />\n";
+ $type='exchange';
+ foreach($mycards as $card)
+ display_link_card($card,$PREF['cardset'],$type);
+ echo ' <input type="submit" class="submitbutton" value="select card to give back" />'."\n";
+ break;
+ case CARDS_MYTURN:
+ echo 'Hello '.$myname.", it's your turn! <br />\n";
+ echo _('Your cards are').": <br />\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').": <br />\n";
+ else
+ {
+ $name = DB_get_name('userid',$myid);
+ echo "$name's were: <br />\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 "<br />";
+
+ $name = DB_get_name('userid',$user);
+ $oldcards = DB_get_all_hand($userhash);
+ $oldcards = mysort($oldcards,$gametype);
+ echo "$name's cards were: <br />\n";
+ foreach($oldcards as $card)
+ display_card($card,$PREF['cardset']);
+ }
+ };
+ break;
+ case CARDS_EMPTY:
+ default:
+ break;
+ }
+echo "</div>\n";
+
+/*****************
+ * show messages *
+ *****************/
+
+if( sizeof($messages) )