<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40550 >

> [EMAIL PROTECTED] - Tue Nov 04 17:16:25 2008]:
> 
> I noticed this with 2.1.6 GTK and have not tested it on
> previous versions.

I have confirmed this bug in S2_1 and trunk.

> The thing is: on multiplayer (turn block) game, if a
> player klicks the turn done button, leaves the game and
> returns before the turn is over, the turn done button is
> active again. On the nations report the status indicator
> is done, though, and when other players klick the button,
> the turn is over.

The client sets its own player's "phase done" state to
FALSE when it receives a start phase packet. The code that
does this was introduced in the patch in ticket #12377
(r10021) to fix a different bug related to the turn done
button at that time.

> A small thing but may cause confusion. Maybe it's also a
> small one to fix?

The amount of code that needs to be changed is small, but the
amount I needed to sift through was not. ;(,,,

Anyway, the attached patches remove the offending code from
S2_1 and trunk, since (with the patches applied) I could not
reproduce the problem described in #12377 (i.e. the turn done
button staying insensitive upon a new turn [except of course
if turnblock=1 and a non-done player disconnects]).


-----------------------------------------------------------------------
どいつもこいつも汚いゴミを片付けることが好きらしい。
diff --git a/client/packhand.c b/client/packhand.c
index 81397fb..b53d6e0 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -1036,10 +1036,6 @@ void handle_start_phase(int phase)
 
   if (NULL != client.conn.playing
       && is_player_phase(client.conn.playing, phase)) {
-    /* HACK: this is updated by the player packet too; we update it here
-     * so the turn done button state will be set properly. */
-    client.conn.playing->phase_done = FALSE;
-
     agents_start_turn();
     non_ai_unit_focus = FALSE;
 
diff --git a/client/packhand.c b/client/packhand.c
index 8991f8f..c5422a0 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -889,10 +889,6 @@ void handle_start_phase(int phase)
   game.info.phase = phase;
 
   if (game.player_ptr && is_player_phase(game.player_ptr, phase)) {
-    /* HACK: this is updated by the player packet too; we update it here
-     * so the turn done button state will be set properly. */
-    game.player_ptr->phase_done = FALSE;
-
     agents_start_turn();
     non_ai_unit_focus = FALSE;
 
@@ -1514,7 +1510,7 @@ void start_revolution(void)
 void handle_player_info(struct packet_player_info *pinfo)
 {
   int i;
-  bool poptechup, new_tech = FALSE;
+  bool poptechup, new_tech = FALSE, phase_done_changed;
   char msg[MAX_LEN_MSG];
   struct player *pplayer = &game.players[pinfo->playerno];
   struct player_research* research;
@@ -1652,10 +1648,7 @@ void handle_player_info(struct packet_player_info *pinfo)
 
   pplayer->is_ready = pinfo->is_ready;
 
-  if (pplayer == game.player_ptr
-      && pplayer->phase_done != pinfo->phase_done) {
-    update_turn_done_button_state();
-  }
+  phase_done_changed = (pplayer->phase_done != pinfo->phase_done);
   pplayer->phase_done = pinfo->phase_done;
 
   pplayer->nturns_idle=pinfo->nturns_idle;
@@ -1665,6 +1658,9 @@ void handle_player_info(struct packet_player_info *pinfo)
   pplayer->revolution_finishes = pinfo->revolution_finishes;
   pplayer->ai.skill_level = pinfo->ai_skill_level;
 
+  if (pplayer == game.player_ptr && phase_done_changed) {
+    update_turn_done_button_state();
+  }
   update_players_dialog();
   update_worklist_report_dialog();
   upgrade_canvas_clipboard();
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to