Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8747) Drop game.load_options
Home

[Freeciv-Dev] (PR#8747) Drop game.load_options

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8747) Drop game.load_options
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 15 May 2004 13:08:08 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch removes the seemingly unused struct game.load_options and the
single path through the savegame loading code which did not load a
ruleset. I looked at the civworld code I had here, and it did not use this
struct, either, so I don't know why it exists.

If I can remove this code path through savegame.c, a big problem with
scenario loading can be fixed in a much easier manner than otherwise.

Mike, any objections?

  - Per

Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.178
diff -u -r1.178 game.c
--- common/game.c       10 Apr 2004 23:05:51 -0000      1.178
+++ common/game.c       15 May 2004 20:00:17 -0000
@@ -290,13 +290,6 @@
   game.save_options.save_starts = TRUE;
   game.save_options.save_private_map = TRUE;
 
-  game.load_options.load_random = TRUE;
-  game.load_options.load_players = TRUE;
-  game.load_options.load_known = TRUE;
-  game.load_options.load_starts = TRUE;
-  game.load_options.load_private_map = TRUE;
-  game.load_options.load_settings = TRUE;
-
   init_our_capability();    
   map_init();
   idex_init();
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.136
diff -u -r1.136 game.h
--- common/game.h       11 May 2004 17:18:19 -0000      1.136
+++ common/game.h       15 May 2004 20:00:18 -0000
@@ -225,15 +225,6 @@
     bool save_starts; /* start positions will be auto generated */
     bool save_private_map; /* FoW map; will be created if not saved */
   } save_options;
-  /* Used by mapeditor to load only the map */
-  struct {
-    bool load_random;
-    bool load_players;
-    bool load_known; /* Only makes sense if the players are loaded. */
-    bool load_starts; /* Should be done if the players are loaded. */
-    bool load_private_map; /* Only makes sense if the players are loaded. */
-    bool load_settings;
-  } load_options;
 
   int trireme_loss_chance[MAX_VET_LEVELS];
   int work_veteran_chance[MAX_VET_LEVELS];
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.149
diff -u -r1.149 savegame.c
--- server/savegame.c   26 Mar 2004 17:31:55 -0000      1.149
+++ server/savegame.c   15 May 2004 20:00:18 -0000
@@ -388,8 +386,7 @@
    */
 
   map_tiles_load(file);
-  if (secfile_lookup_bool_default(file, TRUE, "game.save_starts")
-      && game.load_options.load_starts) {
+  if (secfile_lookup_bool_default(file, TRUE, "game.save_starts")) {
     map_startpos_load(file);
   } else {
     map.num_start_positions = 0;
@@ -410,8 +407,7 @@
                secfile_lookup_str_default(file, NULL, "map.f%03d", nat_y),
                map_get_tile(x, y)->special |= ascii_hex2bin(ch, 3));
 
-  if (secfile_lookup_bool_default(file, TRUE, "game.save_known")
-      && game.load_options.load_known) {
+  if (secfile_lookup_bool_default(file, TRUE, "game.save_known")) {
 
     /* get 4-bit segments of the first half of the 32-bit "known" field */
     LOAD_MAP_DATA(ch, x, y, nat_x, nat_y,
@@ -1280,8 +1276,7 @@
   if (secfile_lookup_int_default(file, -1, "game.fogofwar") != -1
       && game.fogofwar == TRUE
       && secfile_lookup_int_default(file, -1,"player%d.total_ncities", plrno) 
!= -1
-      && secfile_lookup_bool_default(file, TRUE, "game.save_private_map")
-      && game.load_options.load_private_map) {
+      && secfile_lookup_bool_default(file, TRUE, "game.save_private_map")) {
     LOAD_MAP_DATA(ch, x, y, nat_x, nat_y,
                  secfile_lookup_str(file, "player%d.map_t%03d",
                                     plrno, nat_y),
@@ -1954,7 +1949,7 @@
     exit(EXIT_FAILURE);
   }
 
-  if (game.load_options.load_settings) {
+  {
     sz_strlcpy(srvarg.metaserver_info_line,
               secfile_lookup_str_default(file, 
default_meta_server_info_string(),
                                          "game.metastring"));
@@ -2173,7 +2168,7 @@
 
   {
     if (game.version >= 10300) {
-      if (game.load_options.load_settings) {
+      {
        game.settlers = secfile_lookup_int(file, "game.settlers");
        game.explorer = secfile_lookup_int(file, "game.explorer");
        game.dispersion =
@@ -2234,8 +2229,7 @@
      1) if the block exists at all.
      2) if it is saved. */
   if (section_file_lookup(file, "random.index_J")
-      && secfile_lookup_bool_default(file, TRUE, "game.save_random")
-      && game.load_options.load_random) {
+      && secfile_lookup_bool_default(file, TRUE, "game.save_random")) {
     RANDOM_STATE rstate;
     rstate.j = secfile_lookup_int(file,"random.index_J");
     rstate.k = secfile_lookup_int(file,"random.index_K");
@@ -2266,7 +2260,7 @@
 
   map_load(file);
 
-  if (!game.is_new_game && game.load_options.load_players) {
+  if (!game.is_new_game) {
     /* destroyed wonders: */
     string = secfile_lookup_str_default(file, "", "game.destroyed_wonders");
     impr_type_iterate(i) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8747) Drop game.load_options, Per Inge Mathisen <=