add accelerate in [delay]

If accelerate =yes (default no) then the delay time will be affected by
the acceleration set in the preferences.
See https://gna.org/bugs/?21335
This commit is contained in:
gfgtdf 2015-04-05 22:29:55 +02:00
parent b16f9225eb
commit cd0029eac1
3 changed files with 9 additions and 2 deletions

View file

@ -289,6 +289,7 @@ Version 1.13.0-dev:
in place of id, and [object] duration=level.
* Allowed direct modification of unit.ellipse variable even if ellipse= is set
in [unit_type] or by an [object]
* Add accelerate=yes/no key in [delay]
* Miscellaneous and bug fixes:
* replace 'fight_on_without_leader'=yes/no with defeat_condition=no_leader/
no_units/always/never which allows the wml developer to decide when a side

View file

@ -836,7 +836,8 @@ end
function wml_actions.delay(cfg)
local delay = tonumber(cfg.time) or
helper.wml_error "[delay] missing required time= attribute."
wesnoth.delay(delay)
local accelerate = cfg.accelerate or false
wesnoth.delay(delay, accelerate)
end
function wml_actions.floating_text(cfg)

View file

@ -3305,10 +3305,15 @@ int game_lua_kernel::intf_color_adjust(lua_State *L)
/**
* Delays engine for a while.
* - Arg 1: integer.
* - Arg 2: boolean (optional).
*/
int game_lua_kernel::intf_delay(lua_State *L)
{
unsigned final = SDL_GetTicks() + luaL_checkinteger(L, 1);
lua_Integer delay = luaL_checkinteger(L, 1);
if(luaW_toboolean(L, 2) && game_display_ && game_display_->turbo_speed() > 0) {
delay /= game_display_->turbo_speed();
}
const unsigned final = SDL_GetTicks() + delay;
do {
play_controller_.play_slice(false);
if (game_display_) {