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

                 Summary: Division by zero with tech upkeep
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Fri 12 Oct 2012 04:07:29 AM EEST
                Category: ai
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: Ready For Test
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: S2_3
         Discussion Lock: Any
        Operating System: None
         Planned Release: 2.3.3, 2.4.0, 2.5.0

    _______________________________________________________

Details:

I got an division by zero crash from S2_3 with experimental ruleset. There's
code in building advisor that tries to avoid division by zero by adding +1 to
divider, but with tech upkeep active the original value might be -1...

Looking the code it seems to me that division by any negative value will give
bad results, but it would be nice to get second opinion. My proposed fix
attached.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 12 Oct 2012 04:07:29 AM EEST  Name: NegativeParasite.patch  Size:
909B   By: cazfi

<http://gna.org/bugs/download.php?file_id=16685>
-------------------------------------------------------
Date: Fri 12 Oct 2012 04:07:29 AM EEST  Name: NegativeParasite-S2_3.patch 
Size: 948B   By: cazfi

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

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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