Author: sveinung
Date: Wed Nov 25 06:49:06 2015
New Revision: 30757

URL: http://svn.gna.org/viewcvs/freeciv?rev=30757&view=rev
Log:
Ruleset control missing unit upkeep wipe

Give the ruleset control over if a unit is wiped when there aren't enough
food, gold or shields to pay for its upkeep.

The immunity granted by the Undisbandable unit type flag is still hard
coded. What actions a unit is forced to perform before it is wiped, if any,
is still hard coded.

See patch #6632

Modified:
    trunk/common/packets.def
    trunk/data/alien/cities.ruleset
    trunk/data/civ1/cities.ruleset
    trunk/data/civ2/cities.ruleset
    trunk/data/civ2civ3/cities.ruleset
    trunk/data/classic/cities.ruleset
    trunk/data/experimental/cities.ruleset
    trunk/data/multiplayer/cities.ruleset
    trunk/data/sandbox/cities.ruleset
    trunk/data/stub/cities.ruleset
    trunk/fc_version
    trunk/server/cityturn.c
    trunk/server/rscompat.c
    trunk/server/ruleset.c
    trunk/server/ruleset.h
    trunk/tools/ruledit/rulesave.c

Modified: trunk/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/packets.def?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/common/packets.def    (original)
+++ trunk/common/packets.def    Wed Nov 25 06:49:06 2015
@@ -499,6 +499,9 @@
   BOOL killcitizen;
   BOOL killstack;
   UINT8 min_city_center_output[O_LAST];
+  BOOL muuk_food_wipe;
+  BOOL muuk_gold_wipe;
+  BOOL muuk_shield_wipe;
   STRING negative_year_label[MAX_LEN_NAME];
   UINT8 notradesize;
   BOOL nuclear_winter;

Modified: trunk/data/alien/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/alien/cities.ruleset     (original)
+++ trunk/data/alien/cities.ruleset     Wed Nov 25 06:49:06 2015
@@ -94,3 +94,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/civ1/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/civ1/cities.ruleset      (original)
+++ trunk/data/civ1/cities.ruleset      Wed Nov 25 06:49:06 2015
@@ -103,3 +103,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/civ2/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/civ2/cities.ruleset      (original)
+++ trunk/data/civ2/cities.ruleset      Wed Nov 25 06:49:06 2015
@@ -103,3 +103,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/civ2civ3/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/civ2civ3/cities.ruleset  (original)
+++ trunk/data/civ2civ3/cities.ruleset  Wed Nov 25 06:49:06 2015
@@ -105,3 +105,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 75              ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/classic/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/classic/cities.ruleset   (original)
+++ trunk/data/classic/cities.ruleset   Wed Nov 25 06:49:06 2015
@@ -102,3 +102,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/experimental/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/experimental/cities.ruleset      (original)
+++ trunk/data/experimental/cities.ruleset      Wed Nov 25 06:49:06 2015
@@ -104,3 +104,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 75              ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/multiplayer/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/multiplayer/cities.ruleset       (original)
+++ trunk/data/multiplayer/cities.ruleset       Wed Nov 25 06:49:06 2015
@@ -101,3 +101,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/sandbox/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/sandbox/cities.ruleset   (original)
+++ trunk/data/sandbox/cities.ruleset   Wed Nov 25 06:49:06 2015
@@ -105,3 +105,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 75              ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+food_wipe   = TRUE
+
+gold_wipe   = TRUE
+
+shield_wipe = FALSE

Modified: trunk/data/stub/cities.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/cities.ruleset?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/data/stub/cities.ruleset      (original)
+++ trunk/data/stub/cities.ruleset      Wed Nov 25 06:49:06 2015
@@ -66,3 +66,13 @@
 convert_speed = 50              ; base probability 50/1000 -> once every 20 
turns
 partisans_pct = 0               ; percentage of own nationality to inspire 
partisans
                                 ; if 0, original city owner information is 
used instead
+
+[missing_unit_upkeep]
+; Get rid of a unit the city is unable to pay the X upkeep of.
+; X_wipe    - wipe the unit.
+
+; food_wipe   = TRUE
+
+; gold_wipe   = TRUE
+
+; shield_wipe = FALSE

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Wed Nov 25 06:49:06 2015
@@ -54,7 +54,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-2015.Nov.22"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Nov.25"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/cityturn.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/cityturn.c?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/server/cityturn.c     (original)
+++ trunk/server/cityturn.c     Wed Nov 25 06:49:06 2015
@@ -993,7 +993,7 @@
 
         if (upkeep_kill_unit(punit, O_FOOD, ULR_STARVED,
                              /* TODO: Move to the ruleset */
-                             TRUE)) {
+                             game.info.muuk_food_wipe)) {
           notify_player(city_owner(pcity), city_tile(pcity),
                         E_UNIT_LOST_MISC, ftc_server,
                         _("Famine feared in %s, %s lost!"),
@@ -2087,7 +2087,7 @@
          * it self) */
         if (upkeep_kill_unit(punit, O_SHIELD, ULR_DISBANDED,
                              /* TODO: Move to the ruleset */
-                             FALSE)) {
+                             game.info.muuk_shield_wipe)) {
           notify_player(pplayer, city_tile(pcity),
                         E_UNIT_LOST_MISC, ftc_server,
                         _("%s can't upkeep %s, unit disbanded."),
@@ -2546,7 +2546,7 @@
 
     if (upkeep_kill_unit(punit, O_GOLD, ULR_SOLD,
                          /* TODO: Move to the ruleset */
-                         TRUE)) {
+                         game.info.muuk_gold_wipe)) {
       notify_player(pplayer, unit_tile(punit), E_UNIT_LOST_MISC, ftc_server,
                     _("Not enough gold. %s disbanded."),
                     punit_link);

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Wed Nov 25 06:49:06 2015
@@ -236,6 +236,15 @@
     return;
   }
 
+  if (info->ver_cities < 10) {
+    /* Missing unit upkeep. */
+    game.info.muuk_food_wipe = TRUE;
+
+    game.info.muuk_gold_wipe = TRUE;
+
+    game.info.muuk_shield_wipe = FALSE;
+  }
+
   if (info->ver_units < 10) {
     unit_type_iterate(ptype) {
       if (utype_has_flag(ptype, UTYF_SETTLERS)) {

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Wed Nov 25 06:49:06 2015
@@ -4828,6 +4828,19 @@
                                  "citizen.convert_speed");
     game.info.citizen_partisans_pct =
       secfile_lookup_int_default(file, 0, "citizen.partisans_pct");
+
+    /* Missing unit upkeep. */
+    game.info.muuk_food_wipe =
+        secfile_lookup_bool_default(file, RS_DEFAULT_MUUK_FOOD_WIPE,
+                                    "missing_unit_upkeep.food_wipe");
+
+    game.info.muuk_gold_wipe =
+        secfile_lookup_bool_default(file, RS_DEFAULT_MUUK_GOLD_WIPE,
+                                    "missing_unit_upkeep.gold_wipe");
+
+    game.info.muuk_shield_wipe =
+        secfile_lookup_bool_default(file, RS_DEFAULT_MUUK_SHIELD_WIPE,
+                                    "missing_unit_upkeep.shield_wipe");
   }
 
   if (ok) {

Modified: trunk/server/ruleset.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.h?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/server/ruleset.h      (original)
+++ trunk/server/ruleset.h      Wed Nov 25 06:49:06 2015
@@ -61,6 +61,9 @@
 #define GAME_DEFAULT_DISASTER_FREQ       10
 #define GAME_DEFAULT_ACH_UNIQUE          TRUE
 #define GAME_DEFAULT_ACH_VALUE           1
+#define RS_DEFAULT_MUUK_FOOD_WIPE        TRUE
+#define RS_DEFAULT_MUUK_GOLD_WIPE        TRUE
+#define RS_DEFAULT_MUUK_SHIELD_WIPE      FALSE
 #define RS_DEFAULT_TECH_STEAL_HOLES      TRUE
 #define RS_DEFAULT_TECH_TRADE_HOLES      TRUE
 #define RS_DEFAULT_TECH_TRADE_LOSS_HOLES TRUE

Modified: trunk/tools/ruledit/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/rulesave.c?rev=30757&r1=30756&r2=30757&view=diff
==============================================================================
--- trunk/tools/ruledit/rulesave.c      (original)
+++ trunk/tools/ruledit/rulesave.c      Wed Nov 25 06:49:06 2015
@@ -571,6 +571,18 @@
   if (game.info.citizen_partisans_pct != 0) {
     secfile_insert_int(sfile, game.info.citizen_partisans_pct,
                        "citizen.partisans_pct");
+  }
+  if (game.info.muuk_food_wipe != RS_DEFAULT_MUUK_FOOD_WIPE) {
+    secfile_insert_bool(sfile, game.info.muuk_food_wipe,
+                        "missing_unit_upkeep.food_wipe");
+  }
+  if (game.info.muuk_gold_wipe != RS_DEFAULT_MUUK_GOLD_WIPE) {
+    secfile_insert_bool(sfile, game.info.muuk_gold_wipe,
+                        "missing_unit_upkeep.gold_wipe");
+  }
+  if (game.info.muuk_shield_wipe != RS_DEFAULT_MUUK_SHIELD_WIPE) {
+    secfile_insert_bool(sfile, game.info.muuk_shield_wipe,
+                        "missing_unit_upkeep.shield_wipe");
   }
 
   return save_ruleset_file(sfile, filename);


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

Reply via email to