Make undo work again, undeprecate on_event()
Fixes #6898. The issue is that non-WML events added through the new events API always disable undo with no equivalent of WML's `[allow_undo]`. The long-term fix is to add a way to do that; however until that's available then listeners for `moveto` need to use the old `on_event` API. The old `on_event` API can't be deprecated yet, and this is enforced by our unit tests (the build fails if there are unexpected deprecation warnings during the tests). Reverts most of7e234f8833
. Does not revert files that only listen for non-undoable events such as `die` or `new turn`. Reverts the deprecation part of #5663's8cd1332630
.
This commit is contained in:
parent
aa3d399f9d
commit
e3deff8bfd
6 changed files with 9 additions and 6 deletions
2
changelog_entries/fix_undo.md
Normal file
2
changelog_entries/fix_undo.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
### Miscellaneous and bug fixes
|
||||
* Fixed not being able to undo moves (bug #6898)
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
local _ = wesnoth.textdomain 'wesnoth-help'
|
||||
local T = wml.tag
|
||||
local on_event = wesnoth.require("on_event")
|
||||
|
||||
local u_pos_filter = function(u_id)
|
||||
|
||||
|
@ -99,7 +100,7 @@ function wesnoth.wml_actions.on_undo_diversion(cfg)
|
|||
status_anim_update(true)
|
||||
end
|
||||
|
||||
wesnoth.game_events.add_repeating("moveto, die, recruit, recall", function()
|
||||
on_event("moveto, die, recruit, recall", function()
|
||||
status_anim_update()
|
||||
|
||||
end)
|
||||
|
|
|
@ -51,5 +51,5 @@ local function on_event(eventname, priority, fcn)
|
|||
end
|
||||
end
|
||||
|
||||
core_on_event = wesnoth.deprecate_api("on_event", "wesnoth.game_events.add_repeating", 1, nil, on_event)
|
||||
return core_on_event
|
||||
core_on_event = on_event
|
||||
return on_event
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- << pick_advance/main.lua
|
||||
|
||||
local on_event = wesnoth.game_events.add_repeating
|
||||
local on_event = wesnoth.require "on_event"
|
||||
local F = wesnoth.require "functional"
|
||||
local T = wml.tag
|
||||
local _ = wesnoth.textdomain "wesnoth"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
local _ = wesnoth.textdomain 'wesnoth-multiplayer'
|
||||
local T = wml.tag
|
||||
local on_event = wesnoth.game_events.add_repeating
|
||||
local on_event = wesnoth.require("on_event")
|
||||
|
||||
local random_spawns = {
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local _ = wesnoth.textdomain 'wesnoth-multiplayer'
|
||||
local T = wml.tag
|
||||
local on_event = wesnoth.game_events.add_repeating
|
||||
local on_event = wesnoth.require("on_event")
|
||||
|
||||
local random_spawns = {
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue