examples fix

This commit is contained in:
p.kosyh 2009-09-20 13:43:53 +00:00
parent 076c719f73
commit fdd4a85428
2 changed files with 11 additions and 5 deletions

View file

@ -201,7 +201,7 @@ talkm = actmenu('> говорить', 'Talk', true);
openm = actmenu('> открыть', 'Open', true, true); openm = actmenu('> открыть', 'Open', true, true);
closem = actmenu('> закрыть', 'Close', true, true); closem = actmenu('> закрыть', 'Close', true, true);
usem = actmenu('> использовать', 'use', true, true); usem = actmenu('> использовать', 'use', true, true);
givem = actmenu('> отдать', 'use', true, true); givem = actmenu('> отдать', 'use', true, true, true);
rest = menu { rest = menu {
nam = '> отдыхать', nam = '> отдыхать',

View file

@ -81,6 +81,7 @@ end
fill_inv = function(s, w, act) fill_inv = function(s, w, act)
local i, o local i, o
local rc = false
for i,o in opairs(w) do for i,o in opairs(w) do
o = ref(o); o = ref(o);
if isObject(o) and not isDisabled(o) if isObject(o) and not isDisabled(o)
@ -93,8 +94,10 @@ fill_inv = function(s, w, act)
put(act_proxy(o, act), s); put(act_proxy(o, act), s);
end end
fill_inv(s, o.obj, act); fill_inv(s, o.obj, act);
rc = true
end end
end end
return rc
end end
select_only = function(s) select_only = function(s)
@ -110,7 +113,7 @@ select_only = function(s)
end end
end end
actmenu = function(nam, act, _scene, _inv) actmenu = function(nam, act, _scene, _inv, _ifinvonly)
local v = { }; local v = { };
v.action_type = true; v.action_type = true;
v.State = false; v.State = false;
@ -125,13 +128,16 @@ actmenu = function(nam, act, _scene, _inv)
v._inv = _inv; v._inv = _inv;
v.gen = function(s) v.gen = function(s)
local k,o,i local k,o,i
local rc = false
s.obj:zap(); s.obj:zap();
if s._inv then if s._inv then
fill_inv(s, inv(), act); rc =fill_inv(s, inv(), act);
end end
if not _ifinvonly or rc then
if s._scene then if s._scene then
fill_objs(s, here(), act); fill_objs(s, here(), act);
end end
end
select_only(s); select_only(s);
end end
v.inv = function(s) v.inv = function(s)