diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index 052015f..77ee7ac 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -1673,7 +1673,7 @@ int game_cmd(char *cmd) // if (dd) game_cursor(CURSOR_CLEAR); - cmdstr = instead_cmd(cmd); instead_clear(); + cmdstr = instead_cmd(cmd); rc = instead_bretval(1); instead_clear(); game_music_player(); game_sound_player(); @@ -1691,8 +1691,10 @@ int game_cmd(char *cmd) if (!cmdstr) { if (game_pict_modify(NULL)) /* redraw pic only */ game_redraw_pic(); - rc = 1; /* nothing happens */ - goto inv; /* hackish? ok, yes it is... */ + rc = (rc)?0:1; /* nothing happens? */ + if (!rc) + goto inv; /* hackish? ok, yes it is... */ + goto err; /* really nothing to do */ } fading = check_fading(); @@ -2262,7 +2264,6 @@ int game_click(int x, int y, int action, int filter) snd_play(game_theme.click, -1, 0); game_cmd(buf); return 1; - } if (menu_mode || go_mode || elem->id == el_title) diff --git a/stead/click.lua b/stead/click.lua index b1e66c3..01995fd 100644 --- a/stead/click.lua +++ b/stead/click.lua @@ -51,9 +51,6 @@ function(f, s, cmd, x, y, px, py, ...) elseif s.click then r,v = call(s, 'click', tonumber(x), tonumber(y), x2, y2, ...); end - if r == nil and v == nil then - return nil, true - end return r,v end return f(s, cmd, x, y, px, py, ...) diff --git a/stead/input.lua b/stead/input.lua index 8c1f883..08b3ac8 100644 --- a/stead/input.lua +++ b/stead/input.lua @@ -198,9 +198,6 @@ game.action = stead.hook(game.action, function (f, s, cmd, ...) elseif s.inp_enter then r,v = call(s, 'inp_enter'); end --- if r == nil and v == nil then --- return nil, true --- end return r,v -- nothing todo end return f(s, cmd, ...) diff --git a/stead/kbd.lua b/stead/kbd.lua index f29f874..019df4b 100644 --- a/stead/kbd.lua +++ b/stead/kbd.lua @@ -8,9 +8,6 @@ game.action = stead.hook(game.action, function(f, s, cmd, ...) r,v = call(s, 'kbd', input.key_event.down, input.key_event.key); end - if r == nil and v == nil then - return nil, true-- nothing to do - end return r,v end return f(s, cmd, ...); diff --git a/stead/stead.lua b/stead/stead.lua index 03349cb..b975c0f 100644 --- a/stead/stead.lua +++ b/stead/stead.lua @@ -2083,11 +2083,11 @@ iface = { if v ~= false and game.showlast then return r; end - elseif cmd == 'wait' then + elseif cmd == 'wait' then -- nothing todo in game, skip tick v = nil; - r = nil; + r = true; stead.state = true - elseif cmd == 'nop' then + elseif cmd == 'nop' then -- inv only v = true; r = nil; stead.state = true @@ -2098,8 +2098,13 @@ iface = { -- here r is action result, v - ret code value -- state -- game state changed if stead.state and r == nil and v == true then -- we do nothing - return nil; + return nil, true; -- menu end + + if stead.state and r == nil and v == nil then + return nil, nil -- really nothing + end + if RAW_TEXT then v = false end @@ -2128,7 +2133,7 @@ iface = { if vv == nil then -- nil is error return '' end - return vv; + return vv, true; -- action is here end, shell = function(self) local inp, i, k, cmd, a, n; diff --git a/stead/timer.lua b/stead/timer.lua index d178c93..cf1e0ac 100644 --- a/stead/timer.lua +++ b/stead/timer.lua @@ -6,9 +6,6 @@ game.action = stead.hook(game.action, function(f, s, cmd, ...) elseif s.timer then r,v = call(s, 'timer'); end - if r == nil and v == nil then - return nil, true - end return r,v end return f(s, cmd, ...);