Author: sveinung
Date: Tue Mar 15 16:28:10 2016
New Revision: 32247

URL: http://svn.gna.org/viewcvs/freeciv?rev=32247&view=rev
Log:
Unhardcode can't re-home homeless units.

Move the rule that homeless units can't change home city to the ruleset.
This makes it possible to have a ruleset where a unit can escape the
killunhomed server setting by getting a home city.

Requested by Jacob Nevins <jtn>

See patch #7061

Modified:
    trunk/common/actions.c
    trunk/data/alien/game.ruleset
    trunk/data/civ1/game.ruleset
    trunk/data/civ2/game.ruleset
    trunk/data/civ2civ3/game.ruleset
    trunk/data/classic/game.ruleset
    trunk/data/experimental/game.ruleset
    trunk/data/multiplayer/game.ruleset
    trunk/data/sandbox/game.ruleset
    trunk/doc/README.actions
    trunk/fc_version
    trunk/server/rscompat.c
    trunk/server/unithand.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Tue Mar 15 16:28:10 2016
@@ -1426,13 +1426,6 @@
     break;
 
   case ACTION_HOME_CITY:
-    /* Reason: being homeless is a big benefit (no upkeep). */
-    /* Info leak: The player knows if his own unit is homeless. */
-    if (actor_unit->homecity <= 0) {
-      /* Don't home a homeless unit. */
-      return TRI_NO;
-    }
-
     /* Reason: can't change to what is. */
     /* Info leak: The player knows his unit's current home city. */
     if (actor_unit->homecity == target_city->id) {

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/alien/game.ruleset       (original)
+++ trunk/data/alien/game.ruleset       Tue Mar 15 16:28:10 2016
@@ -472,6 +472,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/civ1/game.ruleset        (original)
+++ trunk/data/civ1/game.ruleset        Tue Mar 15 16:28:10 2016
@@ -438,6 +438,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/civ2/game.ruleset        (original)
+++ trunk/data/civ2/game.ruleset        Tue Mar 15 16:28:10 2016
@@ -521,6 +521,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/civ2civ3/game.ruleset    (original)
+++ trunk/data/civ2civ3/game.ruleset    Tue Mar 15 16:28:10 2016
@@ -566,6 +566,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/classic/game.ruleset     (original)
+++ trunk/data/classic/game.ruleset     Tue Mar 15 16:28:10 2016
@@ -523,6 +523,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/experimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/experimental/game.ruleset        (original)
+++ trunk/data/experimental/game.ruleset        Tue Mar 15 16:28:10 2016
@@ -540,6 +540,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/multiplayer/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/multiplayer/game.ruleset (original)
+++ trunk/data/multiplayer/game.ruleset Tue Mar 15 16:28:10 2016
@@ -506,6 +506,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/data/sandbox/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/game.ruleset?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/data/sandbox/game.ruleset     (original)
+++ trunk/data/sandbox/game.ruleset     Tue Mar 15 16:28:10 2016
@@ -606,6 +606,7 @@
 action = "Home City"
 actor_reqs    =
     { "type",   "name", "range", "present"
+      "UnitState", "HasHomeCity", "Local", TRUE
       "DiplRel", "Is foreign", "Local", FALSE
     }
 

Modified: trunk/doc/README.actions
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/doc/README.actions    (original)
+++ trunk/doc/README.actions    Tue Mar 15 16:28:10 2016
@@ -249,8 +249,6 @@
 "Home City" - Set target city as the actor unit's new home city
  * UI name can be set using ui_name_home_city
  * actor must be on the same tile as the target
- * homeless units can't change homecity (this is a feature since being
-   homeless is a big benefit)
  * can't set existing home city as new home city
 
 "Upgrade Unit" - Upgrade the actor unit using the target's facilities.

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Tue Mar 15 16:28:10 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.Mar.15"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Mar.15b"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Tue Mar 15 16:28:10 2016
@@ -526,6 +526,13 @@
 
     enabler->action = ACTION_HOME_CITY;
 
+    /* The actor unit has a home city. (This is a feature since being
+     * homeless is a big benefit. Unless the killunhomed setting is above
+     * 0.) */
+    requirement_vector_append(&enabler->actor_reqs,
+                              req_from_str("UnitState", "Local", FALSE,
+                                           TRUE, TRUE, "HasHomeCity"));
+
     /* The target city must be domestic. */
     requirement_vector_append(&enabler->actor_reqs,
                               req_from_str("DiplRel", "Local", FALSE,

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=32247&r1=32246&r2=32247&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Tue Mar 15 16:28:10 2016
@@ -821,8 +821,7 @@
                                               USP_HAS_HOME_CITY, FALSE)) {
     expl->kind = ANEK_ACTOR_HAS_NO_HOME_CITY;
   } else if ((punit->homecity <= 0)
-             && (action_id == ACTION_HOME_CITY
-                 || action_id == ACTION_TRADE_ROUTE
+             && (action_id == ACTION_TRADE_ROUTE
                  || action_id == ACTION_MARKETPLACE)) {
     expl->kind = ANEK_ACTOR_HAS_NO_HOME_CITY;
   } else if ((must_war_player = need_war_player(punit,


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

Reply via email to