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

[Freeciv-Dev] Re: add a 'topology' server variable allowing varied X and

[Top] [All Lists]

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

Per I. Mathisen wrote:
> On Mon, 13 Oct 2003, rwetmore@xxxxxxxxxxxx wrote:
> 
>>The comment still stands ... what is it that people want to put into the
>>longer explanation. Specifically, what is Per missing that he thinks his
>>comment addressed and didn't, obviously :-).
> 
> 
> The server help should tell the user which ways the different map options
> wrap. Saying "Uranus" is less helpful than "Uranus (wraps N-S)".

Indeed.  Of course the help does say "Uranus (wraps N-S)", but I can see 
that explanations for the others (Flat Earth and Donut World) would be 
helpful.

How about this:

 > help topology
Option: topology  -  The map topology index
Description:
   Two-dimensional maps can wrap at the north-south or
   east-west edges, and use a cartesian or isometric
   rectangular grid.  See the manual for further explanation.
     0 Flat Earth (unwrapped)          4 Flat Earth (isometric)
     1 Earth (wraps E-W)               5 Earth (isometric)
     2 Uranus (wraps N-S)              6 Uranus (isometric)
     3 Donut World (wraps N-S, E-W)    7 Donut World (isometric)
Status: changeable
Value: 1, Minimum: 0, Default: 1, Maximum: 3

I've added a reference to a (nonexistant) manual entry; expanded the 
prose (North-South instead of N-S; it is still shortened in the list), 
removed the _ from Flat_Earth; explained Flat Earth, Earth, and Donut 
World; indented the list; removed the "default" listing from Earth; and 
removed extra whitespace from the list.

jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.335
diff -u -r1.335 packhand.c
--- client/packhand.c   2003/10/13 21:50:27     1.335
+++ client/packhand.c   2003/10/14 15:09:59
@@ -1229,6 +1229,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/14 15:09:59
@@ -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/14 15:09:59
@@ -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/14 15:09:59
@@ -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/14 15:10:00
@@ -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/14 15:10:00
@@ -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/14 15:10: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.139
diff -u -r1.139 savegame.c
--- server/savegame.c   2003/10/07 18:55:09     1.139
+++ server/savegame.c   2003/10/14 15:10:00
@@ -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/14 15:10:00
@@ -232,6 +232,18 @@
          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_("Two-dimensional maps can wrap at the north-south or \n"
+            "east-west edges, and use a cartesian or isometric \n"
+            "rectangular grid.  See the manual for further explanation.\n"
+             "  0 Flat Earth (unwrapped)          4 Flat Earth (isometric)\n"
+             "  1 Earth (wraps E-W)               5 Earth (isometric)\n"
+             "  2 Uranus (wraps N-S)              6 Uranus (isometric)\n"
+             "  3 Donut World (wraps N-S, E-W)    7 Donut World (isometric)"
+          ), 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]