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

Attached patch makes the rather annoying automatic map recentering
when a new turn starts an option, so that people can turn it off if
desired.

Also, moves some calls to functions that as far as I can see should
only be called when entering C_S_RUNNING rather than at the start of
every turn.


-----------------------------------------------------------------------
一遍、浴びてみる?
diff --git a/client/civclient.c b/client/civclient.c
index d944bb8..a7c7d6e 100644
--- a/client/civclient.c
+++ b/client/civclient.c
@@ -60,7 +60,9 @@
 #include "control.h" 
 #include "dialogs_g.h"
 #include "diplodlg_g.h"
+#include "editgui_g.h"
 #include "editor.h"
+#include "graphics_g.h"
 #include "ggzclient.h"
 #include "gui_main_g.h"
 #include "helpdata.h"		/* boot_help_texts() */
@@ -569,6 +571,11 @@ void set_client_state(enum client_states newstate)
       update_unit_focus();
       can_slide = TRUE;
       set_client_page(PAGE_GAME);
+      /* Find something sensible to display instead of the intro gfx. */
+      center_on_something();
+      free_intro_radar_sprites();
+      agents_game_start();
+      editgui_tileset_changed();
       break;
     case C_S_PREPARING:
       popdown_all_city_dialogs();
diff --git a/client/options.c b/client/options.c
index 55f44ae..82d9bc4 100644
--- a/client/options.c
+++ b/client/options.c
@@ -74,6 +74,7 @@ bool do_combat_animation = TRUE;
 bool ai_manual_turn_done = TRUE;
 bool auto_center_on_unit = TRUE;
 bool auto_center_on_combat = FALSE;
+bool auto_center_each_turn = TRUE;
 bool wakeup_focus = TRUE;
 bool goto_into_unknown = TRUE;
 bool center_when_popup_city = TRUE;
@@ -221,6 +222,11 @@ static client_option common_options[] = {
 		     "between turns but may cause you to miss combat "
 		     "entirely."),
 		  COC_INTERFACE),
+  GEN_BOOL_OPTION(auto_center_each_turn, N_("Auto Center on New Turn"),
+                  N_("Set this option to have the client automatically "
+                     "recenter the map on a suitable location at the "
+                     "start of each turn."),
+                  COC_INTERFACE),
   GEN_BOOL_OPTION(wakeup_focus, N_("Focus on Awakened Units"),
 		  N_("Set this option to have newly awoken units be "
 		     "focused automatically."),
diff --git a/client/options.h b/client/options.h
index 610d61a..8b68e16 100644
--- a/client/options.h
+++ b/client/options.h
@@ -38,6 +38,7 @@ extern bool do_combat_animation;
 extern bool ai_manual_turn_done;
 extern bool auto_center_on_unit;
 extern bool auto_center_on_combat;
+extern bool auto_center_each_turn;
 extern bool wakeup_focus;
 extern bool goto_into_unknown;
 extern bool center_when_popup_city;
diff --git a/client/packhand.c b/client/packhand.c
index 2667885..a623dcb 100644
--- a/client/packhand.c
+++ b/client/packhand.c
@@ -55,7 +55,6 @@
 #include "editor.h"
 #include "ggzclient.h"
 #include "goto.h"               /* client_goto_init() */
-#include "graphics_g.h"
 #include "gui_main_g.h"
 #include "helpdata.h"		/* boot_help_texts() */
 #include "inteldlg_g.h"
@@ -398,6 +397,8 @@ static void update_improvement_from_packet(struct city *pcity,
 
 /****************************************************************************
   Updates the client_state due to packets from the server.
+
+  NB: This is called at the beginning of each turn and phase.
 ****************************************************************************/
 static void update_client_state(enum client_states value)
 {
@@ -417,12 +418,9 @@ static void update_client_state(enum client_states value)
     update_unit_focus();
     update_unit_info_label(get_units_in_focus());
 
-    /* Find something sensible to display instead of the intro gfx. */
-    center_on_something();
-    
-    free_intro_radar_sprites();
-    agents_game_start();
-    editgui_tileset_changed();
+    if (auto_center_each_turn) {
+      center_on_something();
+    }
   }
 
   if (C_S_OVER == client_state()) {
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to