Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] add a 'topology' server variable allowing varied X and Y w
Home

[Freeciv-Dev] add a 'topology' server variable allowing varied X and Y w

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] add a 'topology' server variable allowing varied X and Y wrapping (PR#6287)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Oct 2003 16:53:16 -0700
Reply-to: rt@xxxxxxxxxxxxxx

This is an update of the PR#6287 patch.  It adds the server variable and 
allows changing it to toggle X and Y wrapping for the map.  Iso-maps are 
still not allowed (some mapgen support is missing).

This patch does depend on PR#6442 (gen5 wrapping) and PR#6439 
(get_mapview_scroll_window) patches so that everything works properly.

The only drawback to usability is that the help text does include the 
decriptions of iso-maps, even though these values are not allowed yet.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.334
diff -u -r1.334 packhand.c
--- client/packhand.c   2003/10/07 18:55:08     1.334
+++ client/packhand.c   2003/10/10 23:47:07
@@ -1223,6 +1223,7 @@
 {
   map.xsize=pinfo->xsize;
   map.ysize=pinfo->ysize;
+  map.topology_id = pinfo->topology_id;
   map.is_earth=pinfo->is_earth;
 
   map_allocate();
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.146
diff -u -r1.146 capstr.c
--- common/capstr.c     2003/10/02 17:54:57     1.146
+++ common/capstr.c     2003/10/10 23:47:07
@@ -81,7 +81,7 @@
                    "+diplomacy2 +citizens_style +root_tech auth " \
                    "+nat_ulimit +retake +goto_pack borders dip " \
                    "+packet_short_unit +unit_occupied endgame_rep " \
-                   "+terr_flags"
+                   "+terr_flags +topo_id"
 
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
@@ -158,6 +158,9 @@
  *
  * "terr_flags" means terrain flags (with the TER_NO_BARBS flag) have been
  * added.
+ *
+ * "topo_id" means there is a topology_id map value that controls which
+ * topology is in use.  This value is sent to the client.
  */
 
 void init_our_capability(void)
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.147
diff -u -r1.147 map.c
--- common/map.c        2003/10/02 17:54:57     1.147
+++ common/map.c        2003/10/10 23:47:07
@@ -175,6 +175,7 @@
 ***************************************************************/
 void map_init(void)
 {
+  map.topology_id = MAP_DEFAULT_TOPO;
   map.xsize                 = MAP_DEFAULT_WIDTH;
   map.ysize                 = MAP_DEFAULT_HEIGHT;
   map.seed                  = MAP_DEFAULT_SEED;
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.159
diff -u -r1.159 map.h
--- common/map.h        2003/10/02 17:54:57     1.159
+++ common/map.h        2003/10/10 23:47:07
@@ -155,7 +155,8 @@
 };
 
 struct civ_map { 
-  int xsize, ysize;
+  int topology_id;
+  int xsize, ysize; /* native dimensions */
   int seed;
   int riches;
   bool is_earth;
@@ -189,7 +190,7 @@
   TF_ISO = 4
 };
 
-#define CURRENT_TOPOLOGY (TF_WRAPX)
+#define CURRENT_TOPOLOGY (map.topology_id)
 
 #define topo_has_flag(flag) ((CURRENT_TOPOLOGY & (flag)) != 0)
 
@@ -658,6 +659,11 @@
 #define MAP_DEFAULT_HEIGHT       50
 #define MAP_MIN_HEIGHT           25
 #define MAP_MAX_HEIGHT           100
+
+#define MAP_ORIGINAL_TOPO        TF_WRAPX
+#define MAP_DEFAULT_TOPO         TF_WRAPX
+#define MAP_MIN_TOPO             0
+#define MAP_MAX_TOPO             3
 
 #define MAP_DEFAULT_SEED         0
 #define MAP_MIN_SEED             0
Index: common/packets.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.c,v
retrieving revision 1.260
diff -u -r1.260 packets.c
--- common/packets.c    2003/10/07 18:55:08     1.260
+++ common/packets.c    2003/10/10 23:47:08
@@ -1145,6 +1145,7 @@
 
   dio_put_uint8(&dout, pinfo->xsize);
   dio_put_uint8(&dout, pinfo->ysize);
+  dio_put_uint8(&dout, pinfo->topology_id);
   dio_put_bool8(&dout, pinfo->is_earth);
 
   SEND_PACKET_END;
@@ -1159,6 +1160,7 @@
 
   dio_get_uint8(&din, &pinfo->xsize);
   dio_get_uint8(&din, &pinfo->ysize);
+  dio_get_uint8(&din, &pinfo->topology_id);
   dio_get_bool8(&din, &pinfo->is_earth);
 
   RECEIVE_PACKET_END(pinfo);
Index: common/packets.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v
retrieving revision 1.156
diff -u -r1.156 packets.h
--- common/packets.h    2003/10/07 18:55:09     1.156
+++ common/packets.h    2003/10/10 23:47:08
@@ -921,6 +921,7 @@
 *********************************************************/
 struct packet_map_info {
   int xsize, ysize;
+  int topology_id;
   bool is_earth;
 };
 
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.127
diff -u -r1.127 maphand.c
--- server/maphand.c    2003/08/31 17:15:53     1.127
+++ server/maphand.c    2003/10/10 23:47:08
@@ -601,7 +601,7 @@
 }
 
 /**************************************************************************
-  Send basic map information: map size, and is_earth.
+  Send basic map information: map size, topology, and is_earth.
 **************************************************************************/
 void send_map_info(struct conn_list *dest)
 {
@@ -609,6 +609,7 @@
 
   minfo.xsize=map.xsize;
   minfo.ysize=map.ysize;
+  minfo.topology_id = map.topology_id;
   minfo.is_earth=map.is_earth;
  
   lsend_packet_map_info(dest, &minfo);
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.139
diff -u -r1.139 savegame.c
--- server/savegame.c   2003/10/07 18:55:09     1.139
+++ server/savegame.c   2003/10/10 23:47:08
@@ -322,6 +322,9 @@
 ***************************************************************/
 static void map_tiles_load(struct section_file *file)
 {
+  map.topology_id = secfile_lookup_int_default(file, MAP_ORIGINAL_TOPO,
+                                              "map.topology_id");
+
   map.is_earth=secfile_lookup_bool(file, "map.is_earth");
 
   /* In some cases we read these before, but not always, and
@@ -2378,6 +2381,7 @@
      * The first two used to be saved as "map.xsize" and "map.ysize"
      * when PRE_GAME_STATE, but I'm standardizing on width,height --dwp
      */
+    secfile_insert_int(file, map.topology_id, "map.topology_id");
     secfile_insert_int(file, map.xsize, "map.width");
     secfile_insert_int(file, map.ysize, "map.height");
     secfile_insert_int(file, game.settlers, "game.settlers");
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.296
diff -u -r1.296 stdinhand.c
--- server/stdinhand.c  2003/10/09 12:06:22     1.296
+++ server/stdinhand.c  2003/10/10 23:47:08
@@ -232,6 +232,17 @@
          N_("Map height in squares"), "", NULL,
          MAP_MIN_HEIGHT, MAP_MAX_HEIGHT, MAP_DEFAULT_HEIGHT)
 
+  GEN_INT("topology", map.topology_id, SSET_MAP_SIZE, SSET_TO_CLIENT,
+         N_("The map topology index"),
+         N_("2-D maps can wrap at the N-S or E-W edges, \n"
+             "and use a cartesian or isometric rectangular grid. \n"
+             "0 Flat_Earth             4 Flat_Earth  (isometric) \n"
+             "1 Earth  (default)       5 Earth       (isometric) \n"
+             "2 Uranus (wraps N-S)     6 Uranus      (isometric) \n"
+             "3 Donut World            7 Donut World (isometric) \n"
+          ), NULL, 
+         MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO)
+
 /* Map generation parameters: once we have a map these are of historical
  * interest only, and cannot be changed.
  */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] add a 'topology' server variable allowing varied X and Y wrapping (PR#6287), Jason Short <=