Author: sveinung Date: Thu Nov 10 01:22:12 2016 New Revision: 34462 URL: http://svn.gna.org/viewcvs/freeciv?rev=34462&view=rev Log: "Paradrop Unit": Don't rely on "Conquer City".
Determine if a particular drop 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 #25234 Modified: trunk/common/unittype.c trunk/doc/README.actions trunk/server/citytools.c trunk/server/unittools.c Modified: trunk/common/unittype.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=34462&r1=34461&r2=34462&view=diff ============================================================================== --- trunk/common/unittype.c (original) +++ trunk/common/unittype.c Thu Nov 10 01:22:12 2016 @@ -222,6 +222,8 @@ ****************************************************************************/ bool utype_can_take_over(const struct unit_type *punittype) { + /* FIXME: "Paradrop Unit" can in certain circumstances result in city + * conquest. */ return utype_can_do_action(punittype, ACTION_CONQUER_CITY); } Modified: trunk/doc/README.actions URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.actions?rev=34462&r1=34461&r2=34462&view=diff ============================================================================== --- trunk/doc/README.actions (original) +++ trunk/doc/README.actions Thu Nov 10 01:22:12 2016 @@ -374,8 +374,14 @@ - the actor must be at war with each unit on the target tile - a unit at the target tile must be reachable unless it has a city -"Paradrop Unit" +"Paradrop Unit" - move the actor unit to the target tile. * UI name can be set using ui_paradrop_unit + * can result in the conquest of the city at the target tile if + - the actor player isn't an animal barbarian. + - the actor unit has the "CanOccupyCity" unit class flag + - the actor don't have the "NonMil" unit type flag + - the actor's relationship to the target is War + - the target city contains 0 units * the distance between actor and target is from 1 to paratroopers_range * the actor unit hasn't paradropped this turn * the actor unit has paratroopers_mr_req moves left Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=34462&r1=34461&r2=34462&view=diff ============================================================================== --- trunk/server/citytools.c (original) +++ trunk/server/citytools.c Thu Nov 10 01:22:12 2016 @@ -1864,8 +1864,10 @@ /* If we cannot occupy the city, this unit entering will not trigger the * effects below. */ - fc_assert_ret_val_msg(unit_can_take_over(punit), FALSE, - "Bad unit for city occupation."); + fc_assert_ret_val_msg(unit_can_take_over(punit) + || utype_can_do_action(unit_type_get(punit), + ACTION_PARADROP), + FALSE, "Bad unit for city occupation."); /* A transported unit trying to conquer a city should already have been * unloaded. */ Modified: trunk/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=34462&r1=34461&r2=34462&view=diff ============================================================================== --- trunk/server/unittools.c (original) +++ trunk/server/unittools.c Thu Nov 10 01:22:12 2016 @@ -2778,7 +2778,6 @@ **************************************************************************/ 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)) { @@ -2880,9 +2879,16 @@ punit->paradropped = TRUE; if (unit_move(punit, ptile, unit_type_get(punit)->paratroopers_mr_sub, NULL, - /* A paradrop can result in city occupation. */ - ((pcity = tile_city(ptile)) && unit_can_take_over(punit) - && pplayers_at_war(pplayer, city_owner(pcity))))) { + /* A paradrop into a non allied city results in a city + * occupation. */ + /* FIXME: move the following actor requirements to the + * ruleset. One alternative is to split "Paradrop Unit". + * Another is to use different enablers. */ + (pplayer->ai_common.barbarian_type != ANIMAL_BARBARIAN + && uclass_has_flag(unit_class_get(punit), + UCF_CAN_OCCUPY_CITY) + && !unit_has_type_flag(punit, UTYF_CIVILIAN) + && is_non_allied_city_tile(ptile, pplayer)))) { /* 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