[wesnoth-commits] [wesnoth/wesnoth] 982954: Fix #4307: possible crash in attack prediction wit...

Jyrki Vesterinen noreply at github.com
Sun Sep 8 09:39:42 UTC 2019


  Branch: refs/heads/1.14
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 98295475f460f6da7e8e05f44744b48aba3ea1c8
      https://github.com/wesnoth/wesnoth/commit/98295475f460f6da7e8e05f44744b48aba3ea1c8
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2019-09-08 (Sun, 08 Sep 2019)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Fix #4307: possible crash in attack prediction with high number of strikes

If a unit has an attack with ability to poison/slow and a high number of
strikes (24 in the provided test case), the calculated probability of the
other unit being hit and therefore poisoned/slowed could exceed 100 % due to
floating point rounding errors. It caused an assertion failure if the AI
simulated another fight for the target unit afterwards.

Fixed by limiting the probability of being hit to 100 %.





More information about the Commits mailing list