Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#6287) add a 'topology' server variable
Home

[Freeciv-Dev] (PR#6287) add a 'topology' server variable

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6287) add a 'topology' server variable
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Sep 2003 13:54:41 -0700
Reply-to: rt@xxxxxxxxxxxxxx

This patch adds the 'topology' server variable and map.topology_id 
value.  This corresponds to the topo_flag enumeration created earlier. 
Currently only the default value is allowed.

I'm not sure if we're ready for this yet, since the user isn't allowed 
to change it (not all values work).  On the other hand, I suspect soon 
we'll reach a point where some or most values will work, and the 
restrictions can be relaxed.  It also allows easier testing of other 
topologies.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.332
diff -u -r1.332 packhand.c
--- client/packhand.c   2003/09/23 22:01:41     1.332
+++ client/packhand.c   2003/09/25 21:43:00
@@ -1218,6 +1218,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.144
diff -u -r1.144 capstr.c
--- common/capstr.c     2003/09/22 16:54:09     1.144
+++ common/capstr.c     2003/09/25 21:43:00
@@ -80,7 +80,7 @@
                    "+no_nation_selected +diplomacy +no_extra_tiles " \
                    "+diplomacy2 +citizens_style +root_tech auth " \
                    "+nat_ulimit +retake +goto_pack borders dip " \
-                   "+packet_short_unit +unit_occupied"
+                   "+packet_short_unit +unit_occupied +topo_id"
 
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
@@ -152,6 +152,9 @@
  *
  * "unit_occupied" means units occupying transporters are not sent to enemies.
  * instead an 'occupied' flag is set for the transporter.
+ *
+ * "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.145
diff -u -r1.145 map.c
--- common/map.c        2003/09/25 20:55:01     1.145
+++ common/map.c        2003/09/25 21:43:00
@@ -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.154
diff -u -r1.154 map.h
--- common/map.h        2003/09/23 19:47:22     1.154
+++ common/map.h        2003/09/25 21:43:00
@@ -153,7 +153,8 @@
 };
 
 struct civ_map { 
-  int xsize, ysize;
+  int topology_id;
+  int xsize, ysize; /* native dimensions */
   int seed;
   int riches;
   bool is_earth;
@@ -645,6 +646,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             TF_WRAPX
+#define MAP_MAX_TOPO             TF_WRAPX
 
 #define MAP_DEFAULT_SEED         0
 #define MAP_MIN_SEED             0
Index: common/packets.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.h,v
retrieving revision 1.154
diff -u -r1.154 packets.h
--- common/packets.h    2003/09/22 16:54:09     1.154
+++ common/packets.h    2003/09/25 21:43:00
@@ -918,6 +918,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/09/25 21:43:00
@@ -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.137
diff -u -r1.137 savegame.c
--- server/savegame.c   2003/09/22 16:05:39     1.137
+++ server/savegame.c   2003/09/25 21:43:00
@@ -304,6 +304,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
@@ -2341,6 +2344,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.294
diff -u -r1.294 stdinhand.c
--- server/stdinhand.c  2003/09/23 22:01:41     1.294
+++ server/stdinhand.c  2003/09/25 21:43:00
@@ -230,6 +230,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] (PR#6287) add a 'topology' server variable, Jason Short <=