goto. back. goback

This commit is contained in:
p.kosyh 2010-07-11 18:48:47 +00:00
parent b3b5448f9d
commit 04808529ad
2 changed files with 9 additions and 10 deletions

View file

@ -49,8 +49,7 @@ go = function (self, where, back, forceenter)
self.where = deref(where); self.where = deref(where);
end end
if not jump and (not back or forceenter or if not jump and (not back or forceenter) then
not isDialog(ref(was)) or isDialog(ref(where))) then
v, r = call(ref(where), 'enter', ref(was)); v, r = call(ref(where), 'enter', ref(was));
if r == false then if r == false then
self.where = was; self.where = was;
@ -102,6 +101,7 @@ go = function (self, where, back, forceenter)
end end
return res; return res;
end end
stead.go = go
function player_go(self, where) -- cmd iface function player_go(self, where) -- cmd iface
local w = ref(self.where).way:srch(where); local w = ref(self.where).way:srch(where);
@ -112,7 +112,7 @@ function player_go(self, where) -- cmd iface
end end
function player_goto(self, where, ...) -- real work function player_goto(self, where, ...) -- real work
local v, r = go(self, where, unpack(arg)); local v, r = stead.go(self, where, unpack(arg));
return v, r; return v, r;
end end
@ -122,12 +122,11 @@ end
function back() function back()
local where = here(); local where = here();
return me():goto(where.__from__, true); return me():goto(from(), true);
end end
function goback() function goback()
local where = here(); return me():goto(from(), true, true);
return me():goto(where.__from__, true, true);
end end
game.ini = stead.hook(game.ini,function(f, ...) game.ini = stead.hook(game.ini,function(f, ...)
@ -164,7 +163,7 @@ iface.fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed sta
return vv return vv
end end
go = stead.hook(go, function(f, ...) stead.go = stead.hook(stead.go, function(f, ...)
local r,v = f(unpack(arg)) local r,v = f(unpack(arg))
if type(r) == 'string' and cctx() then if type(r) == 'string' and cctx() then
pr (r) pr (r)

View file

@ -1012,7 +1012,7 @@ function phrase_action(self)
r = true; r = true;
end end
if isDialog(here()) and not dialog_rescan(here()) then if isDialog(here()) and not dialog_rescan(here()) then
ret = stead.par(' ', ret, me():back()); ret = stead.par(' ', ret, me():goto(from(), true));
end end
ret = stead.par("^^", last, ret); ret = stead.par("^^", last, ret);
@ -1271,8 +1271,8 @@ function go(self, where, back)
return res; return res;
end end
function player_goto(self, where) function player_goto(self, where, ...)
local v, r = go(self, where, false); local v, r = go(self, where, unpack(arg));
return v, r; return v, r;
end end