tricks with output in game_cmd

This commit is contained in:
p.kosyh@gmail.com 2011-04-14 19:29:07 +00:00
parent ba21b3af94
commit 1b1fa9f03c
6 changed files with 15 additions and 21 deletions

View file

@ -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)

View file

@ -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, ...)

View file

@ -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, ...)

View file

@ -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, ...);

View file

@ -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;

View file

@ -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, ...);