Author: cazfi
Date: Tue Apr 19 18:14:57 2016
New Revision: 32441

URL: http://svn.gna.org/viewcvs/freeciv?rev=32441&view=rev
Log:
Made 'ruleset_locked' available in editor gui.

See patch #7089

Modified:
    trunk/client/gui-gtk-2.0/editprop.c
    trunk/client/gui-gtk-3.0/editprop.c
    trunk/client/gui-gtk-3.0/editprop.h
    trunk/client/gui-gtk-3.x/editprop.c
    trunk/client/gui-gtk-3.x/editprop.h
    trunk/client/packhand.c
    trunk/common/game.c
    trunk/common/packets.def
    trunk/fc_version
    trunk/server/edithand.c
    trunk/server/legacysave.c
    trunk/server/savegame2.c
    trunk/server/savegame3.c

Modified: trunk/client/gui-gtk-2.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/editprop.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/editprop.c (original)
+++ trunk/client/gui-gtk-2.0/editprop.c Tue Apr 19 18:14:57 2016
@@ -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_RULESET_LOCKED
 };
 
 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_RULESET_LOCKED:
+        pv->data.v_bool = pgame->scenario.ruleset_locked;
+        break;
       default:
         log_error("%s(): Unhandled request for value of property %d "
                   "(%s) from object of type \"%s\".", __FUNCTION__,
@@ -2592,6 +2596,9 @@
       case OPID_GAME_LAKE_FLOODING:
         packet->lake_flooding = pv->data.v_bool;
         return;
+      case OPID_GAME_RULESET_LOCKED:
+        packet->ruleset_locked = pv->data.v_bool;
+        return;
       default:
         break;
       }
@@ -3036,6 +3043,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = gtk_check_button_new();
     g_signal_connect(button, "toggled",
         G_CALLBACK(objprop_widget_toggle_button_changed), op);
@@ -3250,6 +3258,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = objprop_get_child_widget(op, "checkbutton");
     disable_gobject_callback(G_OBJECT(button),
         G_CALLBACK(objprop_widget_toggle_button_changed));
@@ -4480,6 +4489,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_RULESET_LOCKED, _("Lock to current Ruleset"),
+            OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     return;
 
   case NUM_OBJTYPES:

Modified: trunk/client/gui-gtk-3.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/editprop.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/editprop.c (original)
+++ trunk/client/gui-gtk-3.0/editprop.c Tue Apr 19 18:14:57 2016
@@ -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_RULESET_LOCKED
 };
 
 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_RULESET_LOCKED:
+        pv->data.v_bool = pgame->scenario.ruleset_locked;
+        break;
       default:
         log_error("%s(): Unhandled request for value of property %d "
                   "(%s) from object of type \"%s\".", __FUNCTION__,
@@ -2593,6 +2597,9 @@
       case OPID_GAME_LAKE_FLOODING:
         packet->lake_flooding = pv->data.v_bool;
         return;
+      case OPID_GAME_RULESET_LOCKED:
+        packet->ruleset_locked = pv->data.v_bool;
+        return;
       default:
         break;
       }
@@ -3052,6 +3059,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = gtk_check_button_new();
     gtk_widget_set_hexpand(button, TRUE);
     gtk_widget_set_halign(button, GTK_ALIGN_END);
@@ -3268,6 +3276,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = objprop_get_child_widget(op, "checkbutton");
     disable_gobject_callback(G_OBJECT(button),
         G_CALLBACK(objprop_widget_toggle_button_changed));
@@ -4520,6 +4529,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_RULESET_LOCKED, _("Lock to current Ruleset"),
+            OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     return;
 
   case NUM_OBJTYPES:

Modified: trunk/client/gui-gtk-3.0/editprop.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/editprop.h?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/editprop.h (original)
+++ trunk/client/gui-gtk-3.0/editprop.h Tue Apr 19 18:14:57 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 2005 - The Freeciv Project
    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

Modified: trunk/client/gui-gtk-3.x/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/editprop.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/editprop.c (original)
+++ trunk/client/gui-gtk-3.x/editprop.c Tue Apr 19 18:14:57 2016
@@ -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_RULESET_LOCKED
 };
 
 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_RULESET_LOCKED:
+        pv->data.v_bool = pgame->scenario.ruleset_locked;
+        break;
       default:
         log_error("%s(): Unhandled request for value of property %d "
                   "(%s) from object of type \"%s\".", __FUNCTION__,
@@ -2593,6 +2597,9 @@
       case OPID_GAME_LAKE_FLOODING:
         packet->lake_flooding = pv->data.v_bool;
         return;
+      case OPID_GAME_RULESET_LOCKED:
+        packet->ruleset_locked = pv->data.v_bool;
+        return;
       default:
         break;
       }
@@ -3052,6 +3059,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = gtk_check_button_new();
     gtk_widget_set_hexpand(button, TRUE);
     gtk_widget_set_halign(button, GTK_ALIGN_END);
@@ -3268,6 +3276,7 @@
   case OPID_GAME_STARTPOS_NATIONS:
   case OPID_GAME_PREVENT_CITIES:
   case OPID_GAME_LAKE_FLOODING:
+  case OPID_GAME_RULESET_LOCKED:
     button = objprop_get_child_widget(op, "checkbutton");
     disable_gobject_callback(G_OBJECT(button),
         G_CALLBACK(objprop_widget_toggle_button_changed));
@@ -4519,6 +4528,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_RULESET_LOCKED, _("Lock to current Ruleset"),
+            OPF_IN_LISTVIEW | OPF_HAS_WIDGET | OPF_EDITABLE, VALTYPE_BOOL);
     return;
 
   case NUM_OBJTYPES:

Modified: trunk/client/gui-gtk-3.x/editprop.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.x/editprop.h?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.x/editprop.h (original)
+++ trunk/client/gui-gtk-3.x/editprop.h Tue Apr 19 18:14:57 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  Freeciv - Copyright (C) 2005 - The Freeciv Project
    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

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Tue Apr 19 18:14:57 2016
@@ -2998,6 +2998,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.ruleset_locked = packet->ruleset_locked;
   game.scenario.save_random = packet->save_random;
   game.scenario.handmade = packet->handmade;
   game.scenario.allow_ai_type_fallback = packet->allow_ai_type_fallback;

Modified: trunk/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/common/game.c (original)
+++ trunk/common/game.c Tue Apr 19 18:14:57 2016
@@ -346,6 +346,7 @@
   game.scenario.handmade = FALSE;
   game.scenario.prevent_new_cities = FALSE;
   game.scenario.lake_flooding = TRUE;
+  game.scenario.ruleset_locked = TRUE;
   game.scenario.save_random = FALSE;
   game.scenario.allow_ai_type_fallback = FALSE;
 

Modified: trunk/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/common/packets.def    (original)
+++ trunk/common/packets.def    Tue Apr 19 18:14:57 2016
@@ -2165,6 +2165,7 @@
   BOOL startpos_nations;
   BOOL prevent_new_cities;
   BOOL lake_flooding;
+  BOOL ruleset_locked;
 end
 
 PACKET_EDIT_SCENARIO_DESC = 14; cs, handle-per-conn

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Tue Apr 19 18:14:57 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-3.0-2016.Apr.19"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Apr.19b"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/edithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/edithand.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/server/edithand.c     (original)
+++ trunk/server/edithand.c     Tue Apr 19 18:14:57 2016
@@ -1395,6 +1395,11 @@
     changed = TRUE;
   }
 
+  if (packet->ruleset_locked != game.scenario.ruleset_locked) {
+    game.scenario.ruleset_locked = packet->ruleset_locked;
+    changed = TRUE;
+  }
+
   if (changed) {
     send_scenario_info(NULL);
     send_game_info(NULL);

Modified: trunk/server/legacysave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/legacysave.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/server/legacysave.c   (original)
+++ trunk/server/legacysave.c   Tue Apr 19 18:14:57 2016
@@ -3168,6 +3168,8 @@
     game.scenario.is_scenario = FALSE;
   }
 
+  game.scenario.ruleset_locked = TRUE;
+
   /* [rulesets] */
   if ((string = secfile_lookup_str(file, "game.rulesetdir"))) {
     /* A ruleset was explicitly required, let's ignore the "rulesetdir"

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Tue Apr 19 18:14:57 2016
@@ -1751,6 +1751,7 @@
   game.scenario.allow_ai_type_fallback
     = secfile_lookup_bool_default(loading->file, FALSE,
                                   "scenario.allow_ai_type_fallback");
+  game.scenario.ruleset_locked = TRUE;
 
   sg_failure_ret(loading->server_state == S_S_INITIAL
                  || (loading->server_state == S_S_RUNNING

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=32441&r1=32440&r2=32441&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Tue Apr 19 18:14:57 2016
@@ -1329,8 +1329,8 @@
                                           "savefile.rulesetdir"));
     if (!strcmp("default", game.server.rulesetdir)) {
       /* Here 'default' really means current default.
-     * Saving happens with real ruleset name, so savegames containing this
-     * are special scenarios. */
+       * Saving happens with real ruleset name, so savegames containing this
+       * are special scenarios. */
       sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
     }
     if (!load_rulesets(NULL, FALSE, TRUE, FALSE)) {


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

Reply via email to