going to 1.4.5

This commit is contained in:
p.kosyh 2011-07-14 12:21:02 +00:00
parent 205d2c4780
commit c82a738ed8
5 changed files with 35 additions and 20 deletions

7
debian/changelog vendored
View file

@ -1,3 +1,10 @@
instead (1.4.5) unstable; urgency=low
* bug fix in rnd() w/o parameter;
* callpush/callpop/cctx moved to stead;
-- Peter Kosyh <p.kosyh@gmail.com> Thu, 14 Jul 2011 16:18:00 +0400
instead (1.4.4) unstable; urgency=low
* bug fix in direct mode (memory leak);

View file

@ -56,4 +56,4 @@ main = xroom {
'apple', 'knife', 'chain', 'tool',
}
}
</code>
</code>

View file

@ -196,15 +196,15 @@ end
stead.go = stead.hook(stead.go, function(f, ...)
local r,v = f(...)
if type(r) == 'string' and cctx() then
if type(r) == 'string' and stead.get_cctx() then
pr (r)
end
if stead.in_life_call then
ACTION_TEXT = nil
end
if r == nil and v == nil then
if cctx() then
cctx().action = true
if stead.get_cctx() then
stead.get_cctx().action = true
else
r = true
end

View file

@ -39,7 +39,7 @@ stead.restore_snapshot = function (nr)
i = do_ini(game, true);
RAW_TEXT = true
-- delete_snapshot(nr);
if cctx() then
if stead.get_cctx() then
pr(i)
end
return i;

View file

@ -98,6 +98,8 @@ function cctx()
return stead.cctx[stead.call_top];
end
stead.get_cctx = cctx
function callpush(v, ...)
stead.call_top = stead.call_top + 1;
stead.cctx[stead.call_top] = { txt = nil, self = v, action = false };
@ -115,6 +117,8 @@ function callpush(v, ...)
self = v
end
stead.callpush = callpush
function clearargs()
arg1 = nil
arg2 = nil
@ -136,38 +140,39 @@ function callpop()
if stead.call_top < 0 then
error ("callpush/callpop mismatch")
end
clearargs()
stead.clearargs()
end
stead.callpop = callpop
function pclr()
cctx().txt = nil
stead.get_cctx().txt = nil
end
stead.pclr = pclr
function pget()
return cctx().txt;
return stead.get_cctx().txt;
end
stead.pget = pget
function p(...)
local i
local a = {...}
for i = 1, stead.table.maxn(a) do
cctx().txt = stead.par('',cctx().txt, tostring(a[i]));
stead.get_cctx().txt = stead.par('', stead.get_cctx().txt, tostring(a[i]));
end
cctx().txt = stead.cat(cctx().txt, ' ');
stead.get_cctx().txt = stead.cat(stead.get_cctx().txt, ' ');
end
stead.p = p
function pr(...)
local i
local a = {...}
for i = 1, stead.table.maxn(a) do
cctx().txt = stead.par('',cctx().txt, tostring(a[i]));
stead.get_cctx().txt = stead.par('', stead.get_cctx().txt, tostring(a[i]));
end
end
stead.pr = pr
function pn(...)
p(...);
cctx().txt = stead.par('',cctx().txt,'^');
stead.get_cctx().txt = stead.par('', stead.get_cctx().txt,'^');
end
stead.pn = pn
-- merge strings with "space" as separator
@ -811,13 +816,13 @@ function call(v, n, ...)
return v[n];
end
if type(v[n]) == 'function' then
callpush(v, ...)
stead.callpush(v, ...)
local a,b = v[n](v, ...);
-- boolean, nil
if type(a) == 'boolean' and b == nil then
b, a = a, stead.pget()
if a == nil then
if cctx().action then
if stead.get_cctx().action then
a = true
else
a = b
@ -828,10 +833,10 @@ function call(v, n, ...)
a = stead.pget()
b = nil
end
if a == nil and b == nil and cctx().action then
if a == nil and b == nil and stead.get_cctx().action then
a = true
end
callpop()
stead.callpop()
return a,b
end
if type(v[n]) == 'boolean' then
@ -854,9 +859,9 @@ function call_bool(v, n, ...)
end
if type(v[n]) == 'function' then
callpush(v, ...)
stead.callpush(v, ...)
local r,v = v[n](v, ...);
callpop();
stead.callpop();
return r,v;
end
return true; -- not nil
@ -874,9 +879,9 @@ function call_value(v, n, ...)
if type(v[n]) ~= 'function' then
return v[n];
end
callpush(v, ...)
stead.callpush(v, ...)
local r,v = v[n](v, ...);
callpop();
stead.callpop();
return r,v;
end
@ -2368,6 +2373,9 @@ end
stead.back = back;
function rnd(m)
if not m then
return math.random();
end
return math.random(m);
end