[Commits] [wesnoth/wesnoth] ab5019: Fix crash when the AI simulates battles with both ...

GitHub noreply at github.com
Sat Sep 23 07:46:04 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: ab5019e31332fede4c82e08ff4c63f0bbff3ecf9
      https://github.com/wesnoth/wesnoth/commit/ab5019e31332fede4c82e08ff4c63f0bbff3ecf9
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2017-09-23 (Sat, 23 Sep 2017)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Fix crash when the AI simulates battles with both swarm and slow

This happened if the AI simulated three fights for an unit that has swarm
and either unit was able to slow in the second fight.

Regression from commit edf750104348841badea50c7d85cd23584d8b1a6.

I didn't take into account that when swarm is used, the probability to stay
unscathed was supposed to be scaled by the probability of the whole combat
slice occurring in the first place. If either unit was able to slow,
complex_fight() calculated the unscaled probability instead, and when they
were added together, the combined probability went way above 100 %. That
triggered an assertion if the AI simulated one more fight for the affected
unit.





More information about the Commits mailing list