[Commits] [wesnoth/wesnoth] 14c6d5: Fixup 9faf17747

GitHub noreply at github.com
Thu Jun 1 00:31:05 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 14c6d534ea5a3628c752685d94b9f099c8b04ef6
      https://github.com/wesnoth/wesnoth/commit/14c6d534ea5a3628c752685d94b9f099c8b04ef6
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-06-01 (Thu, 01 Jun 2017)

  Changed paths:
    M src/actions/advancement.cpp
    M src/ai/default/attack.cpp
    M src/ai/simulated_actions.cpp
    M src/units/unit.cpp
    M src/units/unit.hpp

  Log Message:
  -----------
  Fixup 9faf17747

It seems while my math in the original commit was correct (both usecases - overflow and amount-to-advance - would
yield in the correct positive amount) I failed to consider the fact that some of the code relied on non-positive
numbers for greater-than comparisons.

To compensate, I've split the differential function in two and made each return 0 instead of negative amounts.
This makes the code clearer while not actually breaking anything.





More information about the Commits mailing list