[Commits] [wesnoth/wesnoth] 9336b7: Fix scenario end events not being run on debug-kil...

GitHub noreply at github.com
Thu Aug 4 18:19:25 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 9336b767646eb08243d88672787d12709ec29014
      https://github.com/wesnoth/wesnoth/commit/9336b767646eb08243d88672787d12709ec29014
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-08-04 (Thu, 04 Aug 2016)

  Changed paths:
    M src/menu_events.cpp

  Log Message:
  -----------
  Fix scenario end events not being run on debug-killing the enemy leader

If a developer used the "kill unit" debug command to end a scenario,
the scenario did something special on victory (e.g. showing messages)
and the scenario didn't explicitly set victory_when_enemies_defeated=no,
the special actions were skipped.

The cause was a reference with a too long lifetime.
Menu_handler::kill_unit() obtained a reference to the mouse position and
used it to send "last_breath" and "die" events. But if the mouse position
changed in between (for example, as a result of the last_breath event
doing something), the reference switched to point to the new mouse
position. As a result, the function sent the "die" event with incorrect
coordinates, filtering dropped the event, and the event handlers weren't
run.

Fixed by copying the mouse position instead.





More information about the Commits mailing list