Summary: Zero value effect evaluation zeroes total value of
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Sat 19 Jul 2014 11:59:31 AM EEST
                Category: ai
                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.4.3, 2.5.0, 2.6.0



dai_effect_value() should not return only the value of the effect being
evalatuated, but it added to the base value calculated so far. The shortcut
that checks zero value effects returns 0 instead of unmodified old value.

Fix attached.

Not part of this patch, but I would prefer this to be changesd in trunk so
that dai_effect_value() returned value of the effect being evaluated. Current
interface may have made sense in some distant past, but currently it only
complicates things - the incoming old value is used for nothing but to be
added, so the addition would be as easily be done in caller side. In case of
present = FALSE effects caller needs to calculate the delta out of value that
went in to dai_effect_value() and value that came out.
And then there's the semantical point that function name no way indicate that
it returns something else than the value of the effect.


File Attachments:

Date: Sat 19 Jul 2014 11:59:31 AM EEST  Name: DaiEffectValueZero.patch  Size:
1kB   By: cazfi

Date: Sat 19 Jul 2014 11:59:31 AM EEST  Name: DaiEffectValueZero-S2_5.patch 
Size: 992B   By: cazfi



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to