Skip to content

Commit

Permalink
add an optional delay argument to scroll.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pentarctagon committed Jan 27, 2024
1 parent dcde7c5 commit e657a05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/lua/wml-tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ function wml_actions.scroll(cfg)
end
end
if have_human or #sides == 0 then
wesnoth.interface.scroll(cfg.x or 0, cfg.y or 0)
wesnoth.interface.scroll(cfg.x or 0, cfg.y or 0, cfg.delay or 25)
end
end

Expand Down
10 changes: 9 additions & 1 deletion src/scripting/game_lua_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4650,12 +4650,20 @@ int game_lua_kernel::intf_replace_schedule(lua_State * L)

int game_lua_kernel::intf_scroll(lua_State * L)
{
int x = luaL_checkinteger(L, 1), y = luaL_checkinteger(L, 2);
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
int delay = luaL_optinteger(L, 3, 0);

if (game_display_) {
game_display_->scroll(x, y, true);
}

if(delay != 0) {
lua_remove(L, 1);
lua_remove(L, 1);
intf_delay(L);
}

return 0;
}

Expand Down

0 comments on commit e657a05

Please sign in to comment.