Author: sveinung
Date: Mon Sep 26 12:10:45 2016
New Revision: 33901

URL: http://svn.gna.org/viewcvs/freeciv?rev=33901&view=rev
Log:
action_hard_reqs_actor(): "Airlift Unit" checks.

See patch #7726

Modified:
    trunk/common/actions.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33901&r1=33900&r2=33901&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Mon Sep 26 12:10:45 2016
@@ -1227,6 +1227,39 @@
     }
     break;
 
+  case ACTION_AIRLIFT:
+    {
+      const struct city *psrc_city = tile_city(actor_tile);
+
+      if (psrc_city == NULL) {
+        /* No city to airlift from. */
+        return TRI_NO;
+      }
+
+      if (actor_player != city_owner(psrc_city)
+          && !(game.info.airlifting_style & AIRLIFTING_ALLIED_SRC
+               && pplayers_allied(actor_player, city_owner(psrc_city)))) {
+        /* Not allowed to airlift from this source. */
+        return TRI_NO;
+      }
+
+      if (!(omniscient || city_owner(psrc_city) == actor_player)) {
+        /* Can't check for airlifting capacity. */
+        return TRI_MAYBE;
+      }
+
+      if (0 >= psrc_city->airlift) {
+        /* The source cannot airlift for this turn (maybe already airlifted
+         * or no airport).
+         *
+         * Note that (game.info.airlifting_style & AIRLIFTING_UNLIMITED_SRC)
+         * is not handled here because it always needs an airport to airlift.
+         * See also do_airline() in server/unittools.h. */
+        return TRI_NO;
+      }
+    }
+    break;
+
   case ACTION_ESTABLISH_EMBASSY:
   case ACTION_SPY_INVESTIGATE_CITY:
   case ACTION_SPY_POISON:
@@ -1252,7 +1285,6 @@
   case ACTION_DISBAND_UNIT:
   case ACTION_HOME_CITY:
   case ACTION_UPGRADE_UNIT:
-  case ACTION_AIRLIFT:
     /* No hard unit type requirements. */
     break;
 


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

Reply via email to