Author: sveinung Date: Sun Sep 6 13:07:58 2015 New Revision: 29790 URL: http://svn.gna.org/viewcvs/freeciv?rev=29790&view=rev Log: Let requirements check if a unit is home
Add the new UnitState property OnDomesticTile. It is true if the unit is located withing the borders of its owner. This can be used to limit a hypotetical "Border Patrol" unit's ability to do the "Expel Unit" action to his owner's terrain. (A Local DiplRel requirement would here be to the unit he tries to expel) See patch #6323 Modified: trunk/client/helpdata.c trunk/common/fc_types.h trunk/common/metaknowledge.c trunk/common/requirements.c trunk/doc/README.effects trunk/fc_version Modified: trunk/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/client/helpdata.c (original) +++ trunk/client/helpdata.c Sun Sep 6 13:07:58 2015 @@ -1739,6 +1739,17 @@ } else { cat_snprintf(buf, bufsz, _("Requires that the unit isn't on livable tile.\n")); + } + return TRUE; + case USP_DOMESTIC_TILE: + if (preq->present) { + cat_snprintf(buf, bufsz, + _("Requires that the unit is on a domestic " + "tile.\n")); + } else { + cat_snprintf(buf, bufsz, + _("Requires that the unit isn't on a domestic " + "tile.\n")); } return TRUE; case USP_COUNT: Modified: trunk/common/fc_types.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/common/fc_types.h (original) +++ trunk/common/fc_types.h Sun Sep 6 13:07:58 2015 @@ -291,6 +291,8 @@ #define SPECENUM_VALUE0NAME "Transported" #define SPECENUM_VALUE1 USP_LIVABLE_TILE #define SPECENUM_VALUE1NAME "OnLivableTile" +#define SPECENUM_VALUE2 USP_DOMESTIC_TILE +#define SPECENUM_VALUE2NAME "OnDomesticTile" #define SPECENUM_COUNT USP_COUNT #include "specenum_gen.h" Modified: trunk/common/metaknowledge.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/metaknowledge.c?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/common/metaknowledge.c (original) +++ trunk/common/metaknowledge.c Sun Sep 6 13:07:58 2015 @@ -221,6 +221,7 @@ switch (req->source.value.unit_state) { case USP_TRANSPORTED: case USP_LIVABLE_TILE: + case USP_DOMESTIC_TILE: /* Known if the unit is seen by the player. */ return target_unit && can_player_see_unit(pow_player, target_unit); case USP_COUNT: Modified: trunk/common/requirements.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/requirements.c?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/common/requirements.c (original) +++ trunk/common/requirements.c Sun Sep 6 13:07:58 2015 @@ -2328,6 +2328,10 @@ case USP_LIVABLE_TILE: return BOOL_TO_TRISTATE( can_unit_exist_at_tile(target_unit, unit_tile(target_unit))); + break; + case USP_DOMESTIC_TILE: + return BOOL_TO_TRISTATE( + tile_owner(unit_tile(target_unit)) == unit_owner(target_unit)); break; case USP_COUNT: fc_assert_msg(uprop != USP_COUNT, "Invalid unit state property."); @@ -3236,6 +3240,12 @@ * "Missile+Needs transport") */ _("On native tile")); break; + case USP_DOMESTIC_TILE: + cat_snprintf(buf, bufsz, + /* TRANS: unit state. (appears in strings like + * "Missile+On domestic tile") */ + _("On domestic tile")); + break; case USP_COUNT: fc_assert_msg(psource->value.unit_state != USP_COUNT, "Invalid unit state property."); Modified: trunk/doc/README.effects URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.effects?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/doc/README.effects (original) +++ trunk/doc/README.effects Sun Sep 6 13:07:58 2015 @@ -89,7 +89,7 @@ CityTile is either "Center" (city center) or "Claimed" (owned). DiplRel is a diplomatic relationship. MaxUnitsOnTile is about the number of units present on a tile. -UnitState is "Transported" or "OnLivableTile". +UnitState is "Transported", "OnLivableTile" or "OnDomesticTile". MinMoveFargs is the minimum move fragments the unit must have left. Effect types Modified: trunk/fc_version URL: http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=29790&r1=29789&r2=29790&view=diff ============================================================================== --- trunk/fc_version (original) +++ trunk/fc_version Sun Sep 6 13:07:58 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.Sep.05" +NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Sep.06" NETWORK_CAPSTRING_OPTIONAL="" FREECIV_DISTRIBUTOR="" _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits