pon/poff/prem without parameter

This commit is contained in:
p.kosyh 2009-10-27 15:02:53 +00:00
parent f54434f4d8
commit 9ff01b1c2b

View file

@ -743,17 +743,23 @@ end
function dialog_phrase(self, num) function dialog_phrase(self, num)
if not tonumber(num) then if not tonumber(num) then
if isPhrase(ref(num)) then
return ref(num);
end
return nil return nil
end end
return ref(self.obj[tonumber(num)]); return ref(self.obj[tonumber(num)]);
end end
function ponoff(self, on, ...) function ponoff(s, on, ...)
local i, ph local i, ph
if stead.table.maxn(arg) == 0 then
stead.table.insert(arg, self());
end
for i=1,stead.table.maxn(arg) do for i=1,stead.table.maxn(arg) do
ph = dialog_phrase(self, arg[i]); ph = dialog_phrase(s, arg[i]);
if isPhrase(ph) and not isRemoved(ph) then if isPhrase(ph) and not isRemoved(ph) then
if on then if on then
ph:enable(); ph:enable();
else else
ph:disable(); ph:disable();
@ -763,10 +769,13 @@ function ponoff(self, on, ...)
end end
end end
function dialog_prem(self, ...) function dialog_prem(s, ...)
local i, ph local i, ph
if stead.table.maxn(arg) == 0 then
stead.table.insert(arg, self());
end
for i=1,stead.table.maxn(arg) do for i=1,stead.table.maxn(arg) do
ph = dialog_phrase(self, arg[i]); ph = dialog_phrase(s, arg[i]);
if isPhrase(ph) then if isPhrase(ph) then
ph:remove(); ph:remove();
-- ph.__changed__=true -- ph.__changed__=true