Author: sveinung Date: Sun May 3 16:59:04 2015 New Revision: 28969 URL: http://svn.gna.org/viewcvs/freeciv?rev=28969&view=rev Log: Unhardcode the rule that a unit can't join foreign cities.
Doesn't include everything requested in patch #3843. Is therefore a separate ticket. (A system for foreign cities to reject immigrants is missing) Requested by Jacob Nevins <jtn> See patch #6059 Modified: trunk/common/unit.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/doc/README.actions trunk/fc_version trunk/server/rscompat.c trunk/server/unithand.c Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/common/unit.c (original) +++ trunk/common/unit.c Sun May 3 16:59:04 2015 @@ -428,7 +428,12 @@ if (new_pop > game.info.add_to_size_limit) { return UAB_TOO_BIG; } - if (city_owner(pcity) != unit_owner(punit)) { + if (city_owner(pcity) != unit_owner(punit) + /* TODO: Remove UAB_NOT_OWNER when doing so is safe. */ + /* The ruleset may allow joining foreign cities. */ + && !can_utype_do_act_if_tgt_diplrel(unit_type(punit), + ACTION_JOIN_CITY, + DRO_FOREIGN, TRUE)) { return UAB_NOT_OWNER; } if (!city_can_grow_to(pcity, new_pop)) { Modified: trunk/data/alien/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/alien/game.ruleset (original) +++ trunk/data/alien/game.ruleset Sun May 3 16:59:04 2015 @@ -337,6 +337,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/civ1/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/civ1/game.ruleset (original) +++ trunk/data/civ1/game.ruleset Sun May 3 16:59:04 2015 @@ -323,6 +323,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/civ2/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/civ2/game.ruleset (original) +++ trunk/data/civ2/game.ruleset Sun May 3 16:59:04 2015 @@ -375,6 +375,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/civ2civ3/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/civ2civ3/game.ruleset (original) +++ trunk/data/civ2civ3/game.ruleset Sun May 3 16:59:04 2015 @@ -434,6 +434,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/classic/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/classic/game.ruleset (original) +++ trunk/data/classic/game.ruleset Sun May 3 16:59:04 2015 @@ -406,6 +406,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/experimental/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/experimental/game.ruleset (original) +++ trunk/data/experimental/game.ruleset Sun May 3 16:59:04 2015 @@ -424,6 +424,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/data/multiplayer/game.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/game.ruleset?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/data/multiplayer/game.ruleset (original) +++ trunk/data/multiplayer/game.ruleset Sun May 3 16:59:04 2015 @@ -390,6 +390,7 @@ actor_reqs = { "type", "name", "range", "present" "Unitflag", "AddToCity", "Local", TRUE + "DiplRel", "Is foreign", "Local", FALSE } [borders] Modified: trunk/doc/README.actions URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/doc/README.actions (original) +++ trunk/doc/README.actions Sun May 3 16:59:04 2015 @@ -207,7 +207,6 @@ * actor must have movement left. * target city population must not become higher that the add_to_size_limit setting permits. - * target must not be owned by a foreign player. * target must be able to grow to the size that adding the unit would result in. Modified: trunk/fc_version URL: http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/fc_version (original) +++ trunk/fc_version Sun May 3 16:59:04 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.Apr.30" +NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.May.03" NETWORK_CAPSTRING_OPTIONAL="" FREECIV_DISTRIBUTOR="" Modified: trunk/server/rscompat.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/server/rscompat.c (original) +++ trunk/server/rscompat.c Sun May 3 16:59:04 2015 @@ -281,6 +281,11 @@ req_from_str("UnitFlag", "Local", FALSE, TRUE, "AddToCity")); + /* The target city must be domestic. */ + requirement_vector_append(&enabler->actor_reqs, + req_from_str("DiplRel", "Local", FALSE, + FALSE, "Is foreign")); + action_enabler_add(enabler); } Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=28969&r1=28968&r2=28969&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Sun May 3 16:59:04 2015 @@ -1662,10 +1662,23 @@ citizens_update(pcity, unit_nationality(punit)); /* Refresh the city data. */ city_refresh(pcity); + + /* Notify the unit owner that the unit successfully joined the city. */ notify_player(pplayer, city_tile(pcity), E_CITY_BUILD, ftc_server, _("%s added to aid %s in growing."), unit_tile_link(punit), city_link(pcity)); + if (pplayer != city_owner(pcity)) { + /* Notify the city owner when a foreign unit joins a city. */ + notify_player(city_owner(pcity), city_tile(pcity), E_CITY_BUILD, + ftc_server, + /* TRANS: another player had his unit joint your city. */ + _("%s adds %s to your city %s."), + player_name(unit_owner(punit)), + unit_tile_link(punit), + city_link(pcity));; + } + action_consequence_success(ACTION_JOIN_CITY, pplayer, city_owner(pcity), city_tile(pcity), city_link(pcity)); wipe_unit(punit, ULR_USED, NULL); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits