URL:
  <http://gna.org/bugs/?22363>

                 Summary: Zero value effect evaluation zeroes total value of
improvement
                 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
                 Release: 
         Discussion Lock: Any
        Operating System: None
         Planned Release: 2.4.3, 2.5.0, 2.6.0

    _______________________________________________________

Details:

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

<http://gna.org/bugs/download.php?file_id=21461>
-------------------------------------------------------
Date: Sat 19 Jul 2014 11:59:31 AM EEST  Name: DaiEffectValueZero-S2_5.patch 
Size: 992B   By: cazfi

<http://gna.org/bugs/download.php?file_id=21462>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?22363>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to