URL: <http://gna.org/bugs/?19467>
Summary: Ignored requirement ranges for effect Unit_Recover Project: Freeciv Submitted by: cazfi Submitted on: Sun 19 Feb 2012 02:45:40 AM EET Category: general Severity: 3 - Normal Priority: 5 - Normal Status: Ready For Test Assigned to: None Originator Email: Open/Closed: Open Release: Discussion Lock: Any Operating System: None Planned Release: 2.3.2, 2.4.0, 2.5.0 _______________________________________________________ Details: Checks for effect "Unit_Recover" ignores many requirement ranges that are trivial to support. Any such ignored requirement is always considered fulfilled. More precisely both is_losing_hp() and unit_type_is_losing_hp() use get_player_bonus() to get effect value in player level. No unit or unittype level checks are made. Reported by tirolalira on forums: http://forum.freeciv.org/viewtopic.php?t=6845&start=41 Attached fix makes is_losing_hp() to use get_unit_bonus() that means that also all requirements related to unit itself, or to tile or city it's in are checked. unit_type_is_losing_hp() uses get_unittype_bonus() without any location specific requirements, but allows checking of unit flags, type, and class. While it's a deficiency that is_losing_hp(punit) and unit_type_is_losing_hp(unit_type(punit)) can return different result if some tile or city specific requiment is not met, this is a minor problem. unit_type_is_losing_hp() is used in one place only in classic ai code to make crude categorizing of unit types. Even if unit ends to wrong category, it's just handled less optimally by the AI. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Sun 19 Feb 2012 02:45:40 AM EET Name: RecoveryRanges.diff Size: 1kB By: cazfi <http://gna.org/bugs/download.php?file_id=15166> _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?19467> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev