Author: cazfi
Date: Sat Jun 18 08:07:45 2016
New Revision: 32894

URL: http://svn.gna.org/viewcvs/freeciv?rev=32894&view=rev
Log:
Made 'have_resources' scenario property editor controlled.

Requested by Jacob Nevins <jtn>

See bug #21347

Modified:
    branches/S2_6/client/gui-gtk-2.0/editprop.c
    branches/S2_6/client/gui-gtk-3.0/editprop.c
    branches/S2_6/client/packhand.c
    branches/S2_6/common/game.c
    branches/S2_6/common/map.c
    branches/S2_6/common/map_types.h
    branches/S2_6/common/packets.def
    branches/S2_6/fc_version
    branches/S2_6/server/edithand.c
    branches/S2_6/server/generator/mapgen.c
    branches/S2_6/server/savegame.c
    branches/S2_6/server/savegame2.c
    branches/S2_6/server/srv_main.c

Modified: branches/S2_6/client/gui-gtk-2.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/editprop.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-2.0/editprop.c (original)
+++ branches/S2_6/client/gui-gtk-2.0/editprop.c Sat Jun 18 08:07:45 2016
@@ -356,9 +356,9 @@
   OPID_PLAYER_NATION,
   OPID_PLAYER_GOV,
   OPID_PLAYER_AGE,
-#ifdef DEBUG
+#ifdef FREECIV_DEBUG
   OPID_PLAYER_ADDRESS,
-#endif /* DEBUG */
+#endif /* FREECIV_DEBUG */
   OPID_PLAYER_INVENTIONS,
   OPID_PLAYER_SCIENCE,
   OPID_PLAYER_GOLD,
@@ -372,7 +372,8 @@
   OPID_GAME_SCENARIO_PLAYERS,
   OPID_GAME_STARTPOS_NATIONS,
   OPID_GAME_PREVENT_CITIES,
-  OPID_GAME_LAKE_FLOODING
+  OPID_GAME_LAKE_FLOODING,
+  OPID_GAME_HAVE_RESOURCES
 };
 
 enum object_property_flags {
@@ -1840,6 +1841,9 @@
       case OPID_GAME_LAKE_FLOODING:
         pv->data.v_bool = pgame->scenario.lake_flooding;
         break;
+      case OPID_GAME_HAVE_RESOURCES:
+        pv->data.v_bool = pgame->scenario.have_resources;
+        break;
       default:
         log_error("%s(): Unhandled request for value of property %d "
                   "(%s) from object of type \"%s\".", __FUNCTION__,
@@ -2342,6 +2346,7 @@
       packet->startpos_nations = pgame->scenario.startpos_nations;
       packet->prevent_new_cities = pgame->scenario.prevent_new_cities;
       packet->lake_flooding = pgame->scenario.lake_flooding;
+      packet->have_resources = pgame->scenario.have_resources;
     }
     return;
 
@@ -2595,6 +2600,9 @@
       case OPID_GAME_LAKE_FLOODING:
         packet->lake_flooding = pv->data.v_bool;
         return;
+      case OPID_GAME_HAVE_RESOURCES:
+        packet->have_resources = pv->data.v_bool;
+        return;
       default:
         break;
       }
@@ -3040,6 +3048,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_HAVE_RESOURCES:
     button = gtk_check_button_new();
     g_signal_connect(button, "toggled",
         G_CALLBACK(objprop_widget_toggle_button_changed), op);
@@ -3254,6 +3263,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_HAVE_RESOURCES:
     button = objprop_get_child_widget(op, "checkbutton");
     disable_gobject_callback(G_OBJECT(button),
         G_CALLBACK(objprop_widget_toggle_button_changed));
@@ -4484,6 +4494,8 @@
             OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     ADDPROP(OPID_GAME_LAKE_FLOODING, _("Saltwater Flooding Lakes"),
             OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
+    ADDPROP(OPID_GAME_HAVE_RESOURCES, _("Do not regenerate resources"),
+            OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     return;
 
   case NUM_OBJTYPES:

Modified: branches/S2_6/client/gui-gtk-3.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/editprop.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/editprop.c (original)
+++ branches/S2_6/client/gui-gtk-3.0/editprop.c Sat Jun 18 08:07:45 2016
@@ -357,9 +357,9 @@
   OPID_PLAYER_NATION,
   OPID_PLAYER_GOV,
   OPID_PLAYER_AGE,
-#ifdef DEBUG
+#ifdef FREECIV_DEBUG
   OPID_PLAYER_ADDRESS,
-#endif /* DEBUG */
+#endif /* FREECIV_DEBUG */
   OPID_PLAYER_INVENTIONS,
   OPID_PLAYER_SCIENCE,
   OPID_PLAYER_GOLD,
@@ -373,7 +373,8 @@
   OPID_GAME_SCENARIO_PLAYERS,
   OPID_GAME_STARTPOS_NATIONS,
   OPID_GAME_PREVENT_CITIES,
-  OPID_GAME_LAKE_FLOODING
+  OPID_GAME_LAKE_FLOODING,
+  OPID_GAME_HAVE_RESOURCES
 };
 
 enum object_property_flags {
@@ -1841,6 +1842,9 @@
       case OPID_GAME_LAKE_FLOODING:
         pv->data.v_bool = pgame->scenario.lake_flooding;
         break;
+      case OPID_GAME_HAVE_RESOURCES:
+        pv->data.v_bool = pgame->scenario.have_resources;
+        break;
       default:
         log_error("%s(): Unhandled request for value of property %d "
                   "(%s) from object of type \"%s\".", __FUNCTION__,
@@ -2343,6 +2347,7 @@
       packet->startpos_nations = pgame->scenario.startpos_nations;
       packet->prevent_new_cities = pgame->scenario.prevent_new_cities;
       packet->lake_flooding = pgame->scenario.lake_flooding;
+      packet->have_resources = pgame->scenario.have_resources;
     }
     return;
 
@@ -2596,6 +2601,9 @@
       case OPID_GAME_LAKE_FLOODING:
         packet->lake_flooding = pv->data.v_bool;
         return;
+      case OPID_GAME_HAVE_RESOURCES:
+        packet->have_resources = pv->data.v_bool;
+        return;
       default:
         break;
       }
@@ -3056,6 +3064,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_HAVE_RESOURCES:
     button = gtk_check_button_new();
     gtk_widget_set_hexpand(button, TRUE);
     gtk_widget_set_halign(button, GTK_ALIGN_END);
@@ -3272,6 +3281,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_HAVE_RESOURCES:
     button = objprop_get_child_widget(op, "checkbutton");
     disable_gobject_callback(G_OBJECT(button),
         G_CALLBACK(objprop_widget_toggle_button_changed));
@@ -4524,6 +4534,8 @@
             OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     ADDPROP(OPID_GAME_LAKE_FLOODING, _("Saltwater Flooding Lakes"),
             OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
+    ADDPROP(OPID_GAME_HAVE_RESOURCES, _("Do not regenerate resources"),
+            OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     return;
 
   case NUM_OBJTYPES:

Modified: branches/S2_6/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/packhand.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/client/packhand.c     (original)
+++ branches/S2_6/client/packhand.c     Sat Jun 18 08:07:45 2016
@@ -2964,6 +2964,7 @@
   game.scenario.startpos_nations = packet->startpos_nations;
   game.scenario.prevent_new_cities = packet->prevent_new_cities;
   game.scenario.lake_flooding = packet->lake_flooding;
+  game.scenario.have_resources = packet->have_resources;
   game.scenario.save_random = packet->save_random;
   game.scenario.handmade = packet->handmade;
   game.scenario.allow_ai_type_fallback = packet->allow_ai_type_fallback;

Modified: branches/S2_6/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/game.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/common/game.c (original)
+++ branches/S2_6/common/game.c Sat Jun 18 08:07:45 2016
@@ -345,6 +345,7 @@
   game.scenario.handmade = FALSE;
   game.scenario.prevent_new_cities = FALSE;
   game.scenario.lake_flooding = TRUE;
+  game.scenario.have_resources = FALSE;
   game.scenario.save_random = FALSE;
   game.scenario.allow_ai_type_fallback = FALSE;
 

Modified: branches/S2_6/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/common/map.c  (original)
+++ branches/S2_6/common/map.c  Sat Jun 18 08:07:45 2016
@@ -187,7 +187,6 @@
     game.map.server.single_pole = MAP_DEFAULT_SINGLE_POLE;
     game.map.server.alltemperate = MAP_DEFAULT_ALLTEMPERATE;
     game.map.server.temperature = MAP_DEFAULT_TEMPERATURE;
-    game.map.server.have_resources = FALSE;
     game.map.server.have_huts = FALSE;
     game.map.server.team_placement = MAP_DEFAULT_TEAM_PLACEMENT;
   }

Modified: branches/S2_6/common/map_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/map_types.h?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/common/map_types.h    (original)
+++ branches/S2_6/common/map_types.h    Sat Jun 18 08:07:45 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -95,7 +95,6 @@
       int temperature;
       int wetness;
       int steepness;
-      bool have_resources;
       bool ocean_resources;         /* Resources in the middle of the ocean */
       bool have_huts;
       enum team_placement team_placement;

Modified: branches/S2_6/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/packets.def?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/common/packets.def    (original)
+++ branches/S2_6/common/packets.def    Sat Jun 18 08:07:45 2016
@@ -1886,6 +1886,7 @@
   BOOL   save_random;
   BOOL   prevent_new_cities;
   BOOL   lake_flooding;
+  BOOL   have_resources;
   BOOL   handmade;
   BOOL   allow_ai_type_fallback;
 end
@@ -2132,6 +2133,7 @@
   BOOL startpos_nations;
   BOOL prevent_new_cities;
   BOOL lake_flooding;
+  BOOL have_resources;
 end
 
 PACKET_EDIT_SCENARIO_DESC = 253; cs, handle-per-conn

Modified: branches/S2_6/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/fc_version?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/fc_version    (original)
+++ branches/S2_6/fc_version    Sat Jun 18 08:07:45 2016
@@ -55,7 +55,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2016.May.13"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2016.Jun.18"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: branches/S2_6/server/edithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/edithand.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/server/edithand.c     (original)
+++ branches/S2_6/server/edithand.c     Sat Jun 18 08:07:45 2016
@@ -1446,6 +1446,11 @@
     changed = TRUE;
   }
 
+  if (packet->have_resources != game.scenario.have_resources) {
+    game.scenario.have_resources = packet->have_resources;
+    changed = TRUE;
+  }
+
   if (changed) {
     send_scenario_info(NULL);
     send_game_info(NULL);

Modified: branches/S2_6/server/generator/mapgen.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/generator/mapgen.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/server/generator/mapgen.c     (original)
+++ branches/S2_6/server/generator/mapgen.c     Sat Jun 18 08:07:45 2016
@@ -1361,7 +1361,7 @@
   }
 
   /* some scenarios already provide specials */
-  if (!game.map.server.have_resources) {
+  if (!game.scenario.have_resources) {
     add_resources(game.map.server.riches);
   }
 
@@ -1565,7 +1565,7 @@
     }
   } whole_map_iterate_end;
 
-  game.map.server.have_resources = TRUE;
+  game.scenario.have_resources = TRUE;
 }
 
 /**************************************************************************
@@ -3691,7 +3691,8 @@
       }
     }
   } whole_map_iterate_end;
-  game.map.server.have_resources = TRUE;
+
+  game.scenario.have_resources = TRUE;
   game.map.server.have_huts = TRUE;
 
   fair_map_destroy(pmap);

Modified: branches/S2_6/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/server/savegame.c     (original)
+++ branches/S2_6/server/savegame.c     Sat Jun 18 08:07:45 2016
@@ -1133,7 +1133,8 @@
     } whole_map_iterate_end;
     FC_FREE(known);
   }
-  game.map.server.have_resources = TRUE;
+
+  game.scenario.have_resources = TRUE;
 }
 
 /*****************************************************************************

Modified: branches/S2_6/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame2.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/server/savegame2.c    (original)
+++ branches/S2_6/server/savegame2.c    Sat Jun 18 08:07:45 2016
@@ -2875,7 +2875,7 @@
   sg_save_map_tiles(saving);
   sg_save_map_startpos(saving);
   sg_save_map_tiles_extras(saving);
-  if (game.map.server.have_resources) {
+  if (game.scenario.have_resources) {
     sg_save_savefile_options(saving, " specials");
     sg_save_map_tiles_resources(saving);
   }
@@ -3079,7 +3079,7 @@
     }
   } whole_map_iterate_end;
 
-  game.map.server.have_resources = TRUE;
+  game.scenario.have_resources = TRUE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=32894&r1=32893&r2=32894&view=diff
==============================================================================
--- branches/S2_6/server/srv_main.c     (original)
+++ branches/S2_6/server/srv_main.c     Sat Jun 18 08:07:45 2016
@@ -2940,7 +2940,7 @@
         /* One should never set this to false in scenario map that had 
resources
          * placed. We are safe side here as map generation is retried only if 
this is
          * not scenario map at all. */
-        game.map.server.have_resources = FALSE;
+        game.scenario.have_resources = FALSE;
 
         /* Remove old information already present in tiles */
         map_free();


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to