[wesnoth-commits] [wesnoth/wesnoth] dc7860: Fix a rare crash in attack prediction

Jyrki Vesterinen noreply at github.com
Sat May 11 20:25:55 UTC 2019


  Branch: refs/heads/1.14
  Home:   https://github.com/wesnoth/wesnoth
  Commit: dc78601598e00e54a3e0ce5dc9b21852dd5c8ebe
      https://github.com/wesnoth/wesnoth/commit/dc78601598e00e54a3e0ce5dc9b21852dd5c8ebe
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2019-05-11 (Sat, 11 May 2019)

  Changed paths:
    M src/attack_prediction.cpp

  Log Message:
  -----------
  Fix a rare crash in attack prediction

The crash occurred if
* the AI simulated three fights for a unit in a row
* the unit was initially slowed
* the unit had a chance of killing the attacking unit in the first
fight, removing the slow status
* the second fight was NOT simulated with Monte Carlo mode...
* ...and the third fight was.

It was my mistake from commit d83e0176. I hadn't understood the meaning
of those two function parameters correctly. They don't need to be set to
true if the target unit is already slowed... and, in fact, they must not
be set to true if the attacking unit doesn't slow.

What happened here is that the combat matrix thought that the attacker's
attack slowed the defending unit, placing the result of some of
attacker's hits in the wrong plane. Meanwhile the calculation about the
probability that the defending unit is slowed produced the correct
result. In the next battle, when Monte Carlo mode scaled the "not
slowed" HP distribution with the probability of not being slowed, it
detected the severe discrepancy (in the example case, probabilities only
added up to 12,5 % instead of 100 %) and crashed the game.

This commit fixes the issue by passing correct parameter values.
Fixes #4068.


  Commit: eeb11b2344e43ff171286b95c75b4df552edddff
      https://github.com/wesnoth/wesnoth/commit/eeb11b2344e43ff171286b95c75b4df552edddff
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2019-05-11 (Sat, 11 May 2019)

  Changed paths:
    M changelog.md

  Log Message:
  -----------
  Changelog entry for commit dc78601598e00e54a3e0ce5dc9b21852dd5c8ebe


Compare: https://github.com/wesnoth/wesnoth/compare/964d57d3e878...eeb11b2344e4



More information about the Commits mailing list