Author: jtn
Date: Tue Jun 10 01:25:11 2014
New Revision: 25116

URL: http://svn.gna.org/viewcvs/freeciv?rev=25116&view=rev
Log:
Fix that a unit which is transporting other units can conquer a city.

Reported by Marko Lindqvist (cazfi@gna), patch by pepeto@gna.

See gna bug #20789

Modified:
    branches/S2_4/server/unithand.c

Modified: branches/S2_4/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/unithand.c?rev=25116&r1=25115&r2=25116&view=diff
==============================================================================
--- branches/S2_4/server/unithand.c     (original)
+++ branches/S2_4/server/unithand.c     Tue Jun 10 01:25:11 2014
@@ -1339,6 +1339,7 @@
 {
   struct player *pplayer = unit_owner(punit);
   struct city *pcity = tile_city(pdesttile);
+  bool taking_over_city = FALSE;
 
   /*** Phase 1: Basic checks ***/
 
@@ -1568,6 +1569,7 @@
         return TRUE;
       }
 
+      taking_over_city = TRUE;
       /* Taking over a city is considered a move, so fall through */
     }
   }
@@ -1580,7 +1582,9 @@
     unit_list_iterate(unit_tile(punit)->units, pcargo) {
       if (unit_contained_in(pcargo, punit)
           && (is_non_allied_unit_tile(pdesttile, unit_owner(pcargo))
-              || is_non_allied_city_tile(pdesttile, unit_owner(pcargo)))) {
+              || (!taking_over_city
+                  && is_non_allied_city_tile(pdesttile,
+                                             unit_owner(pcargo))))) {
          notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
                        _("A transported unit is not allied to all "
                          "units or city on target tile."));


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

Reply via email to