Add [move_unit_fake] force_scroll attribute, defaults to 'yes'

This causes the viewport to be scrolled during MUFs even when
[lock_view] is in effect or Follow Unit Actions is disabled in Advanced
Preferences.

Rationale for the default value:
 * Follow Unit Actions is already ignored by [scroll]/[scroll_to] and
   unit [message]s, even in 1.10.x.
 * [move_unit_fake] may be used in cutscenes in conjunction with
   [lock_view]. It is desired to have the viewport scroll to show
   unit movement, and this isn't possible at the moment without
   overriding the implementation of [move_unit_fake] using Lua to
   disable the viewport lock for the duration of the action.
 * Since the above is a rather common scenartio, it is better to
   let the engine handle it correctly without additional code in
   the WML/Lua side. For situations where the [move_unit_fake]
   scrolling is not desired, the user can pass the optional attribute
   themselves.
 * Follow Unit Actions's usefulness outside of unscripted battle
   maps is rather questionable.
This commit is contained in:
Ignacio R. Morelle 2013-07-05 20:09:12 -04:00
parent 0835b35792
commit 62a2789cb2
2 changed files with 9 additions and 2 deletions

View file

@ -8,6 +8,9 @@ Version 1.11.5+dev:
* Updated translations:
* Miscellaneous and bug fixes
* Creating a unit via debug mode now clears fog/shroud around the unit.
* [move_unit_fake] now accepts an optional force_scroll= attribute (def. to
'yes') that allows scrolling the viewport even when [lock_view] is in
effect or Follow Unit Actions is disabled in Advanced Preferences.
Version 1.11.5:
* Add-ons client:

View file

@ -1269,6 +1269,8 @@ WML_HANDLER_FUNCTION(move_unit_fake, /*event_info*/, cfg)
if(!dummy_unit.get())
return;
const bool force_scroll = cfg["force_scroll"].to_bool(true);
const std::string x = cfg["x"];
const std::string y = cfg["y"];
@ -1276,8 +1278,10 @@ WML_HANDLER_FUNCTION(move_unit_fake, /*event_info*/, cfg)
const std::vector<std::string> yvals = utils::split(y);
const std::vector<map_location>& path = fake_unit_path(*dummy_unit, xvals, yvals);
if (!path.empty())
unit_display::move_unit(path, *dummy_unit);
if (!path.empty()) {
// Always scroll.
unit_display::move_unit(path, *dummy_unit, true, map_location::NDIRECTIONS, force_scroll);
}
}
WML_HANDLER_FUNCTION(move_units_fake, /*event_info*/, cfg)