From: Arun Persaud Date: Mon, 6 May 2013 02:37:43 +0000 (-0700) Subject: Make startup phase smoother: less reloading of pages and less text messages to the... X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=decc97576b98d2b422fc30742b7862990dd3d057 Make startup phase smoother: less reloading of pages and less text messages to the user --- diff --git a/include/game.php b/include/game.php index a50b247..15f2e68 100644 --- a/include/game.php +++ b/include/game.php @@ -46,6 +46,7 @@ global $GAME,$RULES,$CARDS; /************************************** * get some information from the DB **************************************/ +start: $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); $mystatus = DB_get_status_by_hash($me); @@ -561,9 +562,7 @@ switch($mystatus) break; } else - { - /* everything is ok, save what user said and proceed */ - $messages[] = _('Processing what you selected in the last step...'); + { /* everything is ok, save what user said and proceed */ /* check if this sickness needs to be handled first */ $startplayer = DB_get_startplayer_by_gameid($gameid); /* need this to check which solo goes first */ @@ -634,13 +633,6 @@ switch($mystatus) * this can therefore only be handled once all players finished the last stage */ - $messages[] = _('Checking if someone else selected solo, nines, wedding or poverty.'); - - /* in case the user can go do the next stage, we want to skip the break statement at the - * end. We keep track of these cases using this variable - */ - $nobreak=0; - /* check if everyone has reached this stage */ $userids = DB_get_all_userid_by_gameid($gameid); $ok = 1; @@ -668,8 +660,6 @@ switch($mystatus) * are playing, in case there are any solos this already * will have the correct information in it */ - $messages[] = _('Ok, everyone is done... figuring out what kind of game we are playing.'); - /* gametype for displaying it (hides hidden solo)*/ $GT = get_display_gametype($gameid); @@ -796,7 +786,6 @@ switch($mystatus) $gametype = 'wedding'; }; /* now the gametype is set correctly in the database */ - $messages[] = _('Got it').' :)'; /* loop over all players, set re/contra if possible and start the game if possible */ $userids = DB_get_all_userid_by_gameid($gameid); @@ -895,9 +884,8 @@ switch($mystatus) } else { - $messages[] = sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"). - "
\n"; - $nobreak=1; + $mystatus = 'play'; + goto play; } } else @@ -909,9 +897,8 @@ switch($mystatus) $whoid = DB_get_userid('gameid-position',$gameid,$who); if($whoid==$myid) { - $messages[] = sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"). - "
take trump, @@ -950,11 +937,6 @@ switch($mystatus) * it is easier to check B) first */ - /* in case the user can go do the next stage, we want to skip the break statement at the - * end. We keep track of these cases using this variable - */ - $nobreak=0; - set_gametype($gametype); /* this sets the $CARDS variable */ $myparty = DB_get_party_by_hash($me); @@ -1008,7 +990,10 @@ switch($mystatus) } } else - $messages[]= sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"); + { + $mystatus = 'play'; + goto play; + } } /* the following is part A) of what needs to be done */ @@ -1207,14 +1192,13 @@ switch($mystatus) } } $messages[] = sprintf(_('Please, continue here'),$INDEX."?action=game&me=$me"); - $nobreak = 1; } } - if(!$nobreak) - break; + break; case 'play': case 'gameover': + play: /* both entries here, so that the tricks are visible for both. * in case of 'play' there is a break later that skips the last part */