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
         Discussion Lock: Any
        Operating System: None
         Planned Release: 2.3.2, 2.4.0, 2.5.0



Checks for effect "Unit_Recover" ignores many requirement ranges that are
trivial to support. Any such ignored requirement is always considered
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:

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



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to