Author: sveinung
Date: Mon Jun 20 00:11:05 2016
New Revision: 32920

URL: http://svn.gna.org/viewcvs/freeciv?rev=32920&view=rev
Log:
Add the new UnitState property OnNativeTile.

See patch #7267

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
    trunk/server/unithand.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/client/helpdata.c     (original)
+++ trunk/client/helpdata.c     Mon Jun 20 00:11:05 2016
@@ -1744,6 +1744,15 @@
                          _("Requires that the unit is homeless.\n"));
           }
           return TRUE;
+        case USP_NATIVE_TILE:
+          if (preq->present) {
+            cat_snprintf(buf, bufsz,
+                         _("Requires that the unit is on native tile.\n"));
+          } else {
+            cat_snprintf(buf, bufsz,
+                         _("Requires that the unit isn't on native tile.\n"));
+          }
+          return TRUE;
         case USP_COUNT:
           fc_assert_msg(preq->source.value.unit_state != USP_COUNT,
                         "Invalid unit state property.");

Modified: trunk/common/fc_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/common/fc_types.h     (original)
+++ trunk/common/fc_types.h     Mon Jun 20 00:11:05 2016
@@ -305,6 +305,8 @@
 #define SPECENUM_VALUE3NAME "Transporting"
 #define SPECENUM_VALUE4 USP_HAS_HOME_CITY
 #define SPECENUM_VALUE4NAME "HasHomeCity"
+#define SPECENUM_VALUE5 USP_NATIVE_TILE
+#define SPECENUM_VALUE5NAME "OnNativeTile"
 #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=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/common/metaknowledge.c        (original)
+++ trunk/common/metaknowledge.c        Mon Jun 20 00:11:05 2016
@@ -236,6 +236,7 @@
     case USP_LIVABLE_TILE:
     case USP_DOMESTIC_TILE:
     case USP_TRANSPORTING:
+    case USP_NATIVE_TILE:
       /* Known if the unit is seen by the player. */
       return target_unit && can_player_see_unit(pow_player, target_unit);
     case USP_HAS_HOME_CITY:

Modified: trunk/common/requirements.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/requirements.c?rev=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/common/requirements.c (original)
+++ trunk/common/requirements.c Mon Jun 20 00:11:05 2016
@@ -2458,6 +2458,10 @@
     return BOOL_TO_TRISTATE(0 < get_transporter_occupancy(target_unit));
   case USP_HAS_HOME_CITY:
     return BOOL_TO_TRISTATE(target_unit->homecity > 0);
+  case USP_NATIVE_TILE:
+    return BOOL_TO_TRISTATE(
+        is_native_tile(unit_type_get(target_unit), unit_tile(target_unit)));
+    break;
   case USP_COUNT:
     fc_assert_msg(uprop != USP_COUNT, "Invalid unit state property.");
     /* Invalid property is unknowable. */
@@ -3429,6 +3433,12 @@
       /* TRANS: unit state. (appears in strings like "Missile+Has a home 
city") */
       cat_snprintf(buf, bufsz, _("Has a home city"));
       break;
+    case USP_NATIVE_TILE:
+      cat_snprintf(buf, bufsz,
+                   /* TRANS: unit state. (appears in strings like
+                    * "Missile+On native tile") */
+                   _("On native 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=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/doc/README.effects    (original)
+++ trunk/doc/README.effects    Mon Jun 20 00:11:05 2016
@@ -92,7 +92,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", "Transporting", "OnLivableTile",
+UnitState is "Transported", "Transporting", "OnNativeTile", "OnLivableTile",
 "OnDomesticTile" or "HasHomeCity".
 MinMoveFargs is the minimum move fragments the unit must have left.
 
@@ -581,6 +581,9 @@
 ------------------------------
 "Transported" is fulfilled if the unit is transported by another unit.
 "Transporting" is fulfilled if the unit is transporting another unit.
+"OnNativeTile" is fulfilled if the unit is on a tile with native terrain or
+               with a native Extra. Doesn't care about details like cities
+               and safe tiles.
 "OnLivableTile" is fulfilled if the unit is on a tile where it can exist
                 outside of a transport.
 "OnDomesticTile" is fulfilled if the unit is on a tile owned by its player.

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Mon Jun 20 00:11:05 2016
@@ -56,7 +56,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.Jun.19"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2016.Jun.20"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=32920&r1=32919&r2=32920&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Mon Jun 20 00:11:05 2016
@@ -691,6 +691,7 @@
   struct player *tgt_player = NULL;
   struct ane_expl *explnat = fc_malloc(sizeof(struct ane_expl));
   bool can_exist = can_unit_exist_at_tile(punit, unit_tile(punit));
+  bool on_native = is_native_tile(unit_type_get(punit), unit_tile(punit));
   int action_custom;
 
   if (action_id == ACTION_ANY) {
@@ -772,6 +773,14 @@
       || (can_exist
           && !utype_can_do_act_when_ustate(unit_type_get(punit), action_id,
                                            USP_LIVABLE_TILE, TRUE))) {
+    explnat->kind = ANEK_BAD_TERRAIN_ACT;
+    explnat->no_act_terrain = tile_terrain(unit_tile(punit));
+  } else if ((!on_native
+       && !utype_can_do_act_when_ustate(unit_type_get(punit), action_id,
+                                        USP_NATIVE_TILE, FALSE))
+      || (on_native
+          && !utype_can_do_act_when_ustate(unit_type_get(punit), action_id,
+                                           USP_NATIVE_TILE, TRUE))) {
     explnat->kind = ANEK_BAD_TERRAIN_ACT;
     explnat->no_act_terrain = tile_terrain(unit_tile(punit));
   } else if (punit


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

Reply via email to