[Freeciv-Dev] (PR#9941) rename seed values
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9941 >
> drop rand:
> game.seed and map.seed
> more logically connected with the server variables and shorter too!
ok...
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.184
diff -u -r1.184 game.c
--- common/game.c 4 Sep 2004 20:19:51 -0000 1.184
+++ common/game.c 6 Sep 2004 16:03:04 -0000
@@ -261,7 +261,7 @@
#else
game.save_compress_level = GAME_NO_COMPRESS_LEVEL;
#endif
- game.randseed=GAME_DEFAULT_RANDSEED;
+ game.seed = GAME_DEFAULT_SEED;
game.watchtower_vision=GAME_DEFAULT_WATCHTOWER_VISION;
game.watchtower_extra_vision=GAME_DEFAULT_WATCHTOWER_EXTRA_VISION,
game.allowed_city_names = GAME_DEFAULT_ALLOWED_CITY_NAMES;
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.150
diff -u -r1.150 game.h
--- common/game.h 6 Sep 2004 02:58:11 -0000 1.150
+++ common/game.h 6 Sep 2004 16:03:04 -0000
@@ -129,7 +129,7 @@
int techpenalty;
int razechance;
bool scorelog;
- int randseed;
+ int seed;
int aqueduct_size;
int sewer_size;
int add_to_size_limit;
@@ -285,9 +285,9 @@
extern struct civ_game game;
extern bool is_server;
-#define GAME_DEFAULT_RANDSEED 0
-#define GAME_MIN_RANDSEED 0
-#define GAME_MAX_RANDSEED (MAX_UINT32 >> 1)
+#define GAME_DEFAULT_SEED 0
+#define GAME_MIN_SEED 0
+#define GAME_MAX_SEED (MAX_UINT32 >> 1)
#define GAME_DEFAULT_GOLD 50
#define GAME_MIN_GOLD 0
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 6 Sep 2004 16:03:04 -0000
@@ -193,7 +193,7 @@
map.xsize = MAP_MIN_LINEAR_SIZE;
map.ysize = MAP_MIN_LINEAR_SIZE;
- map.seed = MAP_DEFAULT_SEED;
+ map.seed = MAP_DEFAULT_SEED;
map.riches = MAP_DEFAULT_RICHES;
map.huts = MAP_DEFAULT_HUTS;
map.landpercent = MAP_DEFAULT_LANDMASS;
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 6 Sep 2004 16:03:05 -0000
@@ -1598,9 +1598,9 @@
/* save the current random state: */
RANDOM_STATE rstate = get_myrand_state();
- if (map.seed==0)
+ if (map.seed == 0) {
map.seed = (myrand(MAX_UINT32) ^ time(NULL)) & (MAX_UINT32 >> 1);
-
+ }
mysrand(map.seed);
/* don't generate tiles with mapgen==0 as we've loaded them from file */
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 6 Sep 2004 16:03:06 -0000
@@ -2998,8 +2998,8 @@
1.10.0 */
game.occupychance = secfile_lookup_int_default(file, game.occupychance,
"game.occupychance");
- game.randseed = secfile_lookup_int_default(file, game.randseed,
- "game.randseed");
+ game.seed = secfile_lookup_int_default(file, game.seed,
+ "game.randseed");
game.allowed_city_names =
secfile_lookup_int_default(file, game.allowed_city_names,
"game.allowed_city_names");
@@ -3488,7 +3488,7 @@
secfile_insert_bool(file, map.separatepoles, "map.separatepoles");
}
- secfile_insert_int(file, game.randseed, "game.randseed");
+ secfile_insert_int(file, game.seed, "game.randseed");
if (myrand_is_init() && game.save_options.save_random) {
RANDOM_STATE rstate = get_myrand_state();
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 6 Sep 2004 16:03:06 -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.seed,
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,17 +338,17 @@
"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.seed,
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 "
"on the time."), NULL,
- GAME_MIN_RANDSEED, GAME_MAX_RANDSEED, GAME_DEFAULT_RANDSEED)
+ GAME_MIN_SEED, GAME_MAX_SEED, GAME_DEFAULT_SEED)
GEN_INT("specials", map.riches,
SSET_MAP_ADD, SSET_ECOLOGY, SSET_VITAL, SSET_TO_CLIENT,
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.185
diff -u -r1.185 srv_main.c
--- server/srv_main.c 4 Sep 2004 21:25:58 -0000 1.185
+++ server/srv_main.c 6 Sep 2004 16:03:07 -0000
@@ -149,14 +149,14 @@
**************************************************************************/
void init_game_seed(void)
{
- if (game.randseed == 0) {
+ if (game.seed == 0) {
/* We strip the high bit for now because neither game file nor
server options can handle unsigned ints yet. - Cedric */
- game.randseed = time(NULL) & (MAX_UINT32 >> 1);
+ game.seed = time(NULL) & (MAX_UINT32 >> 1);
}
if (!myrand_is_init()) {
- mysrand(game.randseed);
+ mysrand(game.seed);
}
}
|
|