[wesnoth-commits] [wesnoth/wesnoth] bee64f: Check unit/second_unit existence in FORCE_CHANCE_T...

Iris Morelle noreply at github.com
Thu Mar 14 02:57:12 UTC 2019


  Branch: refs/heads/1.14
  Home:   https://github.com/wesnoth/wesnoth
  Commit: bee64fc78bc81477d3bc49d08fb3cfa779041659
      https://github.com/wesnoth/wesnoth/commit/bee64fc78bc81477d3bc49d08fb3cfa779041659
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2019-03-13 (Wed, 13 Mar 2019)

  Changed paths:
    M changelog.md
    M data/core/macros/utils.cfg

  Log Message:
  -----------
  Check unit/second_unit existence in FORCE_CHANCE_TO_HIT

Fixes an issue where the auxiliary event handlers for 'attack end' in
this macro might break if the affected unit or units are removed from
the map by a pre-existing 'attack end' event handler.

Unfortunately this still results in log warnings about failing to
auto-store unit/second_unit, but it's better than breaking WML execution
entirely.

    20190313 23:36:48 error engine: failed to auto-store $second_unit at (9,40)

The alternative I contemplated was to force unit/second_unit to be valid
in the event handlers by using empty filters, but then that would result
in the event handler being triggered *later* by another valid unit. This
is especially problematic since the event handler handles special
knowledge about the unit's WML ([specials][original_chance_to_hit]).
That option would not produce any spurious error messages but would
definitely cause new problems, especially when interacting with other
FCTH substitutions in the same scenario.

Ultimately FCTH's design is a bit questionable and relies too much on
state that may be broken by an external agent intentionally or otherwise
and produce unusual results.

Closes #3982.

[ci skip]





More information about the Commits mailing list