Implement [lock_view] and [unlock_view] WML actions

They are trivial wrappers for the wesnoth.lock_view() function in Lua.
Neither takes any parameters.

There is no wrapper for wesnoth.view_locked() yet until I decide on its
name and usefulness factor.
This commit is contained in:
Ignacio R. Morelle 2012-06-11 23:10:03 +00:00
parent 3536a15b27
commit 50e7a70883
2 changed files with 11 additions and 0 deletions

View file

@ -273,6 +273,9 @@ Version 1.11.0-svn:
* [scroll_to] and [scroll_to_unit] now accept an optional boolean immediate=
attribute (defaults to false) specifying whether to ignore the scroll
speed setting in Preferences and instantly warp to the selected location
* Added [lock_view] and [unlock_view] WML actions, for locking and unlocking
gamemap view scrolling (so the user cannot scroll, while WML/Lua actions
still can, i.e. for cutscenes)
* Miscellaneous and bug fixes:
* Fix wrong preferences path suffix (1.1 instead of 1.10) on Linux and other
platforms using XDG layout (no compiled-in preferences path override,

View file

@ -359,6 +359,14 @@ function wml_actions.scroll_to_unit(cfg)
wesnoth.scroll_to_tile(u.x, u.y, cfg.check_fogged, cfg.immediate)
end
function wml_actions.lock_view(cfg)
wesnoth.lock_view(true)
end
function wml_actions.unlock_view(cfg)
wesnoth.lock_view(false)
end
function wml_actions.select_unit(cfg)
local u = wesnoth.get_units(cfg)[1]
if not u then return end