Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9941) rename seed values
Home

[Freeciv-Dev] (PR#9941) rename seed values

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9941) rename seed values
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 4 Sep 2004 15:18:09 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9941 >

Currently we have

   game.randseed <=> "randseed"
   map.seed <=> "seed"

This has always bothered me.  They are both rand seeds.  One is for the 
map generation and one is for the game.  I propose they be renamed:

   game.randseed <=> "gameseed"
   map.randseed <=> "mapseed"

The values in savegames should be left unchanged.

jason

Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.192
diff -u -r1.192 map.c
--- common/map.c        3 Sep 2004 15:12:25 -0000       1.192
+++ common/map.c        4 Sep 2004 22:16:27 -0000
@@ -193,7 +193,7 @@
   map.xsize = MAP_MIN_LINEAR_SIZE;  
   map.ysize = MAP_MIN_LINEAR_SIZE;
 
-  map.seed                  = MAP_DEFAULT_SEED;
+  map.randseed = MAP_DEFAULT_SEED;
   map.riches                = MAP_DEFAULT_RICHES;
   map.huts                  = MAP_DEFAULT_HUTS;
   map.landpercent           = MAP_DEFAULT_LANDMASS;
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.213
diff -u -r1.213 map.h
--- common/map.h        3 Sep 2004 15:12:25 -0000       1.213
+++ common/map.h        4 Sep 2004 22:16:28 -0000
@@ -159,7 +159,7 @@
   int num_iterate_outwards_indices;
   int size; /* used to calculate [xy]size */
   int xsize, ysize; /* native dimensions */
-  int seed;
+  int randseed;
   int riches;
   int huts;
   int landpercent;
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.155
diff -u -r1.155 mapgen.c
--- server/mapgen.c     4 Sep 2004 11:47:56 -0000       1.155
+++ server/mapgen.c     4 Sep 2004 22:16:29 -0000
@@ -1598,10 +1598,10 @@
   /* save the current random state: */
   RANDOM_STATE rstate = get_myrand_state();
  
-  if (map.seed==0)
-    map.seed = (myrand(MAX_UINT32) ^ time(NULL)) & (MAX_UINT32 >> 1);
-
-  mysrand(map.seed);
+  if (map.randseed == 0) {
+    map.randseed = (myrand(MAX_UINT32) ^ time(NULL)) & (MAX_UINT32 >> 1);
+  }
+  mysrand(map.randseed);
 
   /* don't generate tiles with mapgen==0 as we've loaded them from file */
   /* also, don't delete (the handcrafted!) tiny islands in a scenario */
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.184
diff -u -r1.184 savegame.c
--- server/savegame.c   4 Sep 2004 21:25:57 -0000       1.184
+++ server/savegame.c   4 Sep 2004 22:16:29 -0000
@@ -3093,7 +3093,7 @@
       map.riches = secfile_lookup_int(file, "map.riches");
       map.huts = secfile_lookup_int(file, "map.huts");
       map.generator = secfile_lookup_int(file, "map.generator");
-      map.seed = secfile_lookup_int(file, "map.seed");
+      map.randseed = secfile_lookup_int(file, "map.seed");
       map.landpercent = secfile_lookup_int(file, "map.landpercent");
       map.grasssize =
        secfile_lookup_int_default(file, MAP_DEFAULT_GRASS, "map.grasssize");
@@ -3472,7 +3472,7 @@
     secfile_insert_int(file, map.ysize, "map.height");
     secfile_insert_str(file, game.start_units, "game.start_units");
     secfile_insert_int(file, game.dispersion, "game.dispersion");
-    secfile_insert_int(file, map.seed, "map.seed");
+    secfile_insert_int(file, map.randseed, "map.seed");
     secfile_insert_int(file, map.landpercent, "map.landpercent");
     secfile_insert_int(file, map.riches, "map.riches");
     secfile_insert_int(file, map.swampsize, "map.swampsize");
Index: server/settings.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.c,v
retrieving revision 1.2
diff -u -r1.2 settings.c
--- server/settings.c   4 Sep 2004 20:36:10 -0000       1.2
+++ server/settings.c   4 Sep 2004 22:16:30 -0000
@@ -330,7 +330,7 @@
          N_("Amount of desert squares"), "", NULL, 
          MAP_MIN_DESERTS, MAP_MAX_DESERTS, MAP_DEFAULT_DESERTS)
 
-  GEN_INT("seed", map.seed,
+  GEN_INT("mapseed", map.randseed,
          SSET_MAP_GEN, SSET_INTERNAL, SSET_RARE, SSET_SERVER_ONLY,
          N_("Map generation random seed"),
          N_("The same seed will always produce the same map; "
@@ -338,12 +338,12 @@
             "the time, to give a random map."), NULL, 
          MAP_MIN_SEED, MAP_MAX_SEED, MAP_DEFAULT_SEED)
 
-  /* Map additional stuff: huts and specials.  randseed also goes here
-   * because huts and specials are the first time the randseed gets used (?)
+  /* Map additional stuff: huts and specials.  gameseed also goes here
+   * because huts and specials are the first time the gameseed gets used (?)
    * These are done when the game starts, so these are historical and
    * fixed after the game has started.
    */
-  GEN_INT("randseed", game.randseed,
+  GEN_INT("gameseed", game.randseed,
          SSET_MAP_ADD, SSET_INTERNAL, SSET_RARE, SSET_SERVER_ONLY,
          N_("General random seed"),
          N_("For zero (the default) a seed will be chosen based "

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9941) rename seed values, Jason Short <=