Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] (PR#15810) Editor: Recalculate borders
Home

[Freeciv-Dev] (PR#15810) Editor: Recalculate borders

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15810) Editor: Recalculate borders
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 8 Mar 2006 11:41:56 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This adds a new menu item to the editor to recalculate borders. This is
useful as you do not have to wait for end turn for borders to expand, eg
if you have added new cities or fortresses.

  - Per

Index: server/maphand.c
===================================================================
--- server/maphand.c    (revision 11738)
+++ server/maphand.c    (working copy)
@@ -1789,3 +1789,15 @@
   assert(server_state != RUN_GAME_STATE || vision->radius_sq[V_INVIS] < 0);
   free(vision);
 }
+
+/****************************************************************************
+  Client editor requests us to recalculate borders. Note that this does
+  not necessarily extend borders to their maximum due to the way the
+  borders code is written. This may be considered a feature or limitation.
+****************************************************************************/
+void handle_recalculate_borders(struct connection *pc)
+{
+  if (game.info.is_edit_mode) {
+    map_calculate_borders();
+  }
+}
Index: common/packets.def
===================================================================
--- common/packets.def  (revision 11738)
+++ common/packets.def  (working copy)
@@ -1427,3 +1427,6 @@
   SINT16 love[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
   UINT16 small_wonders[B_LAST]; diff
 end
+
+PACKET_RECALCULATE_BORDERS=131;cs,handle-per-conn
+end
Index: client/control.c
===================================================================
--- client/control.c    (revision 11738)
+++ client/control.c    (working copy)
@@ -2720,3 +2720,11 @@
 {
   dsend_packet_edit_mode(&aconnection, !game.info.is_edit_mode);
 }
+
+/**************************************************************************
+  Recalculate borders.
+**************************************************************************/
+void key_editor_recalc_borders(void)
+{
+  send_packet_recalculate_borders(&aconnection);
+}
Index: client/gui-gtk-2.0/menu.c
===================================================================
--- client/gui-gtk-2.0/menu.c   (revision 11738)
+++ client/gui-gtk-2.0/menu.c   (working copy)
@@ -163,6 +163,7 @@
  
   MENU_EDITOR_TOGGLE,
   MENU_EDITOR_TOOLS,
+  MENU_EDITOR_RECALC_BORDERS,
 
   MENU_HELP_LANGUAGES,
   MENU_HELP_CONNECTING,
@@ -601,6 +602,9 @@
   case MENU_EDITOR_TOOLS:
     editdlg_show_tools();
     break;
+  case MENU_EDITOR_RECALC_BORDERS:
+    key_editor_recalc_borders();
+    break;
   }
 }
 
@@ -938,6 +942,8 @@
     editor_menu_callback, MENU_EDITOR_TOGGLE, "<CheckItem>" },
   { "/" N_("_Editor") "/" N_("_Tools"), NULL,
     editor_menu_callback, MENU_EDITOR_TOOLS },
+  { "/" N_("_Editor") "/" N_("_Recalculate Borders"), NULL,
+    editor_menu_callback, MENU_EDITOR_RECALC_BORDERS },
 
   /* Help menu ... */
   { "/" N_("_Help"),                                   NULL,
@@ -1333,6 +1339,7 @@
 
     menus_set_sensitive("<main>/_Editor", TRUE);
     menus_set_sensitive("<main>/_Editor/_Tools", game.info.is_edit_mode);
+    menus_set_sensitive("<main>/_Editor/_Recalculate Borders", 
game.info.is_edit_mode);
     menus_set_active("<main>/_Editor/Editing Mode", game.info.is_edit_mode);
 
     /* Remaining part of this function: Update Orders menu */
Index: client/control.h
===================================================================
--- client/control.h    (revision 11738)
+++ client/control.h    (working copy)
@@ -197,6 +197,7 @@
 void key_unit_select_battlegroup(int battlegroup, bool append);
 
 void key_editor_toggle(void);
+void key_editor_recalc_borders(void);
 
 /* don't change this unless you also put more entries in data/Freeciv */
 #define MAX_NUM_UNITS_BELOW 4

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15810) Editor: Recalculate borders, Per I. Mathisen <=