Skip to content

Commit

Permalink
improve performance of wesnoth.delay(0)
Browse files Browse the repository at this point in the history
In this case we don't need to call resources::screen->delay(10) or SDL_GetTicks()
  • Loading branch information
gfgtdf committed Dec 6, 2015
1 parent 01d4c6a commit b6ea858
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/scripting/lua.cpp
Expand Up @@ -3374,7 +3374,12 @@ static int intf_remove_tile_overlay(lua_State *L)
*/
static int intf_delay(lua_State *L)
{
unsigned final = SDL_GetTicks() + luaL_checkinteger(L, 1);
lua_Integer delay = luaL_checkinteger(L, 1);
if(delay == 0) {
resources::controller->play_slice(false);
return 0;
}
unsigned final = SDL_GetTicks() + delay;
do {
resources::controller->play_slice(false);
resources::screen->delay(10);
Expand Down

0 comments on commit b6ea858

Please sign in to comment.