Author: sveinung
Date: Sun Nov 13 16:42:42 2016
New Revision: 34495

URL: http://svn.gna.org/viewcvs/freeciv?rev=34495&view=rev
Log:
Lua server scripts: don't rely on "Conquer City".

Determine if a particular Lua triggered unit move is a city conquest based
on the old rules rather than on if the actor unit ever can do the "Conquer
City" action.

See bug #25280

Modified:
    trunk/server/scripting/api_server_edit.c

Modified: trunk/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.c?rev=34495&r1=34494&r2=34495&view=diff
==============================================================================
--- trunk/server/scripting/api_server_edit.c    (original)
+++ trunk/server/scripting/api_server_edit.c    Sun Nov 13 16:42:42 2016
@@ -151,7 +151,11 @@
                     /* The old call would result in occupation before the
                      * checks below. */
                     ((pcity = tile_city(dest))
-                     && unit_can_take_over(punit)
+                     && (unit_owner(punit)->ai_common.barbarian_type
+                         != ANIMAL_BARBARIAN)
+                     && uclass_has_flag(unit_class_get(punit),
+                                        UCF_CAN_OCCUPY_CITY)
+                     && !unit_has_type_flag(punit, UTYF_CIVILIAN)
                      && pplayers_at_war(unit_owner(punit),
                                         city_owner(pcity))));
   if (alive) {
@@ -530,7 +534,11 @@
                    /* Backwards compatibility for old scripts in rulesets
                     * and (scenario) savegames. */
                    ((pcity = tile_city(ptile))
-                    && unit_can_take_over(punit)
+                    && (unit_owner(punit)->ai_common.barbarian_type
+                        != ANIMAL_BARBARIAN)
+                    && uclass_has_flag(unit_class_get(punit),
+                                       UCF_CAN_OCCUPY_CITY)
+                    && !unit_has_type_flag(punit, UTYF_CIVILIAN)
                     && pplayers_at_war(unit_owner(punit),
                                        city_owner(pcity))));
 }


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

Reply via email to