Author: sveinung Date: Fri Aug 12 20:34:34 2016 New Revision: 33579 URL: http://svn.gna.org/viewcvs/freeciv?rev=33579&view=rev Log: Handle paratroopers_range in the action system.
See patch #7583 Modified: trunk/common/actions.c trunk/server/unithand.c trunk/server/unittools.c Modified: trunk/common/actions.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33579&r1=33578&r2=33579&view=diff ============================================================================== --- trunk/common/actions.c (original) +++ trunk/common/actions.c Fri Aug 12 20:34:34 2016 @@ -1602,6 +1602,14 @@ return TRI_NO; } + /* Reason: Keep paratroopers_range working. */ + /* Info leak: The player knows the location of the actor and of the + * target tile. */ + if (unit_type_get(actor_unit)->paratroopers_range + < real_map_distance(actor_tile, target_tile)) { + return TRI_NO; + } + break; case ACTION_AIRLIFT: Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=33579&r1=33578&r2=33579&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Fri Aug 12 20:34:34 2016 @@ -946,6 +946,11 @@ > action_by_number(action_id)->max_distance))) { explnat->kind = ANEK_DISTANCE_FAR; explnat->distance = action_by_number(action_id)->max_distance; + } else if (action_id == ACTION_PARADROP && punit && target_tile + && real_map_distance(unit_tile(punit), target_tile) + > unit_type_get(punit)->paratroopers_range) { + explnat->kind = ANEK_DISTANCE_FAR; + explnat->distance = unit_type_get(punit)->paratroopers_range; } else if (action_id_is_valid(action_id) && punit && ((target_tile && real_map_distance(unit_tile(punit), target_tile) Modified: trunk/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=33579&r1=33578&r2=33579&view=diff ============================================================================== --- trunk/server/unittools.c (original) +++ trunk/server/unittools.c Fri Aug 12 20:34:34 2016 @@ -2713,17 +2713,6 @@ bool do_paradrop(struct unit *punit, struct tile *ptile) { struct player *pplayer = unit_owner(punit); - int range, distance; - - range = unit_type_get(punit)->paratroopers_range; - distance = real_map_distance(unit_tile(punit), ptile); - if (distance > range) { - notify_player(pplayer, ptile, E_BAD_COMMAND, ftc_server, - _("The distance to the target (%i) " - "is greater than the unit's range (%i)."), - distance, range); - return FALSE; - } if (map_is_known_and_seen(ptile, pplayer, V_MAIN)) { if (!can_unit_exist_at_tile(punit, ptile) _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits