Summary: Revised logic for AI improvement consideration and
improvement redundancy
                 Project: Freeciv
            Submitted by: persia
            Submitted on: Tue 01 Jul 2014 01:42:37 PM JST
                Category: general
                Priority: 5 - Normal
                  Status: Works For Me
                 Privacy: Public
             Assigned to: persia
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.6.0



The attached patch series is my interpretation of the right solution for bug

The first patch in the series removes the use of is_effect_prevented() from
adjust_improvement_wants_by_effects(), and replaces it with checks inside the
reqs loop for specific types of requirements and conditions (in some cases,
present==FALSE means we can't have it, in others present==TRUE means we can't
have it, and the remainder are more complex).  This is not a complete list of
all possible requirements, but should cover all the cases where we know in
advance things are impossible (while letting through things that are possible,
but the AI has no idea how to accomplish: fixing this is left for future

The second patch in the series attempts to reconstruct the semantics from
is_effect_useful (removed with the patch from bug #21982) in
is_improvement_redundant(): unfortunately the appropriate logic is subtly
different from that in get_current_construction_bonus(), so is_effect_useful()
cannot be simply reinstated, to better capture the state of improvements that
are not obsolete, yet provide no effect.  Note that this doesn't capture all
cases: a building may meet reqs for action enablers, extras, disasters, or
other conditions not captured here (but again, outside the direct intent of
this patch).  I'm unsure whether the right solution is to list all the
potential improvement utilisation conditions in this function, or to move the
ruleset cache to requirements.c, and centrally cache all uses of

As these collectively include the reversion of most of a recent commit
(r25032), I'd appreciate comments indicating others also like these semantics
before application.


File Attachments:

Date: Tue 01 Jul 2014 01:42:37 PM JST  Name:
AI-check-missing-improvement-reqs-with-more-care.patch  Size: 7kB   By: persia

Date: Tue 01 Jul 2014 01:42:37 PM JST  Name:
consider-utility-for-improvement-redundancy.patch  Size: 7kB   By: persia



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to