Author: cazfi
Date: Fri Dec 25 16:06:20 2015
New Revision: 31197

URL: http://svn.gna.org/viewcvs/freeciv?rev=31197&view=rev
Log:
Make client not to increase local turn counter immediately after player's own 
phase, but
only just before turn change handling.

See bug #24167

Modified:
    branches/S2_6/client/packhand.c

Modified: branches/S2_6/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/packhand.c?rev=31197&r1=31196&r2=31197&view=diff
==============================================================================
--- branches/S2_6/client/packhand.c     (original)
+++ branches/S2_6/client/packhand.c     Fri Dec 25 16:06:20 2015
@@ -1199,7 +1199,97 @@
 **************************************************************************/
 void handle_end_phase(void)
 {
+  /* Messagewindow will contain events happened since our own phase ended,
+   * so player of the first phase and last phase are in equal situation. */
   meswin_clear();
+}
+
+/**************************************************************************
+  Called by the network code when an start-phase packet is received.  This
+  may be the start of our phase or someone else's phase.
+**************************************************************************/
+void handle_start_phase(int phase)
+{
+  if (!client_has_player() && !client_is_observer()) {
+    /* We are on detached state, let ignore this packet. */
+    return;
+  }
+
+  if (phase < 0
+      || (game.info.phase_mode == PMT_PLAYERS_ALTERNATE
+          && phase >= player_count())
+      || (game.info.phase_mode == PMT_TEAMS_ALTERNATE
+          && phase >= team_count())) {
+    log_error("handle_start_phase() illegal phase %d.", phase);
+    return;
+  }
+
+  set_client_state(C_S_RUNNING);
+
+  game.info.phase = phase;
+
+  /* Possibly replace wait cursor with something else */
+  if (phase == 0) {
+    /* TODO: Have server set as busy also if switching phase
+     * is taking long in a alternating phases mode. */
+    set_server_busy(FALSE);
+  }
+
+  if (NULL != client.conn.playing
+      && is_player_phase(client.conn.playing, phase)) {
+    agents_start_turn();
+    non_ai_unit_focus = FALSE;
+
+    update_turn_done_button_state();
+
+    if (client.conn.playing->ai_controlled
+        && !gui_options.ai_manual_turn_done) {
+      user_ended_turn();
+    }
+
+    unit_focus_set_status(client.conn.playing);
+
+    city_list_iterate(client.conn.playing->cities, pcity) {
+      pcity->client.colored = FALSE;
+    } city_list_iterate_end;
+
+    unit_list_iterate(client.conn.playing->units, punit) {
+      punit->client.colored = FALSE;
+    } unit_list_iterate_end;
+
+    update_map_canvas_visible();
+  }
+
+  update_info_label();
+}
+
+/**************************************************************************
+  Called when begin-turn packet is received. Server has finished processing
+  turn change.
+**************************************************************************/
+void handle_begin_turn(void)
+{
+  log_debug("handle_begin_turn()");
+
+  /* Server is still considered busy until it handles also the beginning
+   * of the first phase. */
+
+  stop_turn_change_wait();
+}
+
+/**************************************************************************
+  Called when end-turn packet is received. Server starts processing turn
+  change.
+**************************************************************************/
+void handle_end_turn(void)
+{
+  log_debug("handle_end_turn()");
+
+  /* Make sure wait cursor is in use */
+  set_server_busy(TRUE);
+
+  start_turn_change_wait();
+
   /*
    * The local idea of the game.info.turn is increased here since the
    * client will get unit updates (reset of move points for example)
@@ -1210,93 +1300,6 @@
    */
   game.info.turn++;
   agents_before_new_turn();
-}
-
-/**************************************************************************
-  Called by the network code when an start-phase packet is received.  This
-  may be the start of our phase or someone else's phase.
-**************************************************************************/
-void handle_start_phase(int phase)
-{
-  if (!client_has_player() && !client_is_observer()) {
-    /* We are on detached state, let ignore this packet. */
-    return;
-  }
-
-  if (phase < 0
-      || (game.info.phase_mode == PMT_PLAYERS_ALTERNATE
-          && phase >= player_count())
-      || (game.info.phase_mode == PMT_TEAMS_ALTERNATE
-          && phase >= team_count())) {
-    log_error("handle_start_phase() illegal phase %d.", phase);
-    return;
-  }
-
-  set_client_state(C_S_RUNNING);
-
-  game.info.phase = phase;
-
-  /* Possibly replace wait cursor with something else */
-  if (phase == 0) {
-    /* TODO: Have server set as busy also if switching phase
-     * is taking long in a alternating phases mode. */
-    set_server_busy(FALSE);
-  }
-
-  if (NULL != client.conn.playing
-      && is_player_phase(client.conn.playing, phase)) {
-    agents_start_turn();
-    non_ai_unit_focus = FALSE;
-
-    update_turn_done_button_state();
-
-    if (client.conn.playing->ai_controlled
-        && !gui_options.ai_manual_turn_done) {
-      user_ended_turn();
-    }
-
-    unit_focus_set_status(client.conn.playing);
-
-    city_list_iterate(client.conn.playing->cities, pcity) {
-      pcity->client.colored = FALSE;
-    } city_list_iterate_end;
-
-    unit_list_iterate(client.conn.playing->units, punit) {
-      punit->client.colored = FALSE;
-    } unit_list_iterate_end;
-
-    update_map_canvas_visible();
-  }
-
-  update_info_label();
-}
-
-/**************************************************************************
-  Called when begin-turn packet is received. Server has finished processing
-  turn change.
-**************************************************************************/
-void handle_begin_turn(void)
-{
-  log_debug("handle_begin_turn()");
-
-  /* Server is still considered busy until it handles also the beginning
-   * of the first phase. */
-
-  stop_turn_change_wait();
-}
-
-/**************************************************************************
-  Called when end-turn packet is received. Server starts processing turn
-  change.
-**************************************************************************/
-void handle_end_turn(void)
-{
-  log_debug("handle_end_turn()");
-
-  /* Make sure wait cursor is in use */
-  set_server_busy(TRUE);
-
-  start_turn_change_wait();
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to