Author: sveinung
Date: Tue Mar 29 08:28:06 2016
New Revision: 32271

URL: http://svn.gna.org/viewcvs/freeciv?rev=32271&view=rev
Log:
"Paradrop Unit" check action system integration.

See patch #7058

Modified:
    trunk/common/actions.c
    trunk/common/unit.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=32271&r1=32270&r2=32271&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Tue Mar 29 08:28:06 2016
@@ -1088,10 +1088,26 @@
 
   case ACTION_PARADROP:
     /* Reason: Keep the old rules. */
-    /* Info leak: The player knows if his unit has paradropped this turn,
-     * how many move fragments it has left and if it is standing in a city
-     * or in a base with the ParadropFrom flag. */
-    if (!can_unit_paradrop(actor_unit)) {
+    /* Info leak: The player knows if his unit already has paradropped this
+     * turn. */
+    if (actor_unit->paradropped) {
+      return TRI_NO;
+    }
+
+    /* Reason: Support the paratroopers_mr_req unit type field. */
+    /* Info leak: The player knows how many move fragments his unit has
+     * left. */
+    if (actor_unit->moves_left < actor_unittype->paratroopers_mr_req) {
+      return TRI_NO;
+    }
+
+    /* Reason: Keep the old rules. */
+    /* Info leak: The player knows if his unit is standing in a city or in
+     * a base with the ParadropFrom flag. */
+    if (!(tile_has_base_flag(actor_tile, BF_PARADROP_FROM)
+          || tile_city(actor_tile))) {
+      /* Paradrop has to be possible from non-native base.
+       * Paratroopers are "Land" units, but they can paradrom from Airbase. */
       return TRI_NO;
     }
 

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=32271&r1=32270&r2=32271&view=diff
==============================================================================
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Tue Mar 29 08:28:06 2016
@@ -693,31 +693,7 @@
 **************************************************************************/
 bool can_unit_paradrop(const struct unit *punit)
 {
-  struct unit_type *utype;
-
-  if (!unit_can_do_action(punit, ACTION_PARADROP)) {
-    return FALSE;
-  }
-
-  if(punit->paradropped)
-    return FALSE;
-
-  utype = unit_type_get(punit);
-
-  if(punit->moves_left < utype->paratroopers_mr_req)
-    return FALSE;
-
-  if (tile_has_base_flag(unit_tile(punit), BF_PARADROP_FROM)) {
-    /* Paradrop has to be possible from non-native base.
-     * Paratroopers are "Land" units, but they can paradrom from Airbase. */
-    return TRUE;
-  }
-
-  if (!tile_city(unit_tile(punit))) {
-    return FALSE;
-  }
-
-  return TRUE;
+  return action_maybe_possible_actor_unit(ACTION_PARADROP, punit);
 }
 
 /**************************************************************************


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

Reply via email to