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

Jyrki Vesterinen noreply at github.com
Sun Sep 8 09:40:51 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 1b7f9a3ef89b652a76aa5a4af71976d085af08ee
      https://github.com/wesnoth/wesnoth/commit/1b7f9a3ef89b652a76aa5a4af71976d085af08ee
  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