Author: sveinung
Date: Wed Oct  5 02:23:41 2016
New Revision: 33995

URL: http://svn.gna.org/viewcvs/freeciv?rev=33995&view=rev
Log:
Paradrop Unit: city conquest only when possible.

The action "Paradrop Unit" can result in the conquest of the city being
landed in. Don't try to conquer unless the target tile has a city, the actor
unit can take over cities and the actor unit's owner is at war with the
target city's owner.

See patch #7753

Modified:
    trunk/server/unittools.c

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=33995&r1=33994&r2=33995&view=diff
==============================================================================
--- trunk/server/unittools.c    (original)
+++ trunk/server/unittools.c    Wed Oct  5 02:23:41 2016
@@ -2757,6 +2757,7 @@
 **************************************************************************/
 bool do_paradrop(struct unit *punit, struct tile *ptile)
 {
+  struct city *pcity;
   struct player *pplayer = unit_owner(punit);
 
   if (map_is_known_and_seen(ptile, pplayer, V_MAIN)) {
@@ -2857,8 +2858,10 @@
   /* All ok */
   punit->paradropped = TRUE;
   if (unit_move(punit, ptile, unit_type_get(punit)->paratroopers_mr_sub,
+                NULL,
                 /* A paradrop can result in city occupation. */
-                NULL, TRUE)) {
+                ((pcity = tile_city(ptile)) && unit_can_take_over(punit)
+                 && pplayers_at_war(pplayer, city_owner(pcity))))) {
     /* Ensure we finished on valid state. */
     fc_assert(can_unit_exist_at_tile(punit, unit_tile(punit))
               || unit_transported(punit));


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

Reply via email to