From 04808529ad0ce66732d77444b234d7289d1f5261 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Sun, 11 Jul 2010 18:48:47 +0000 Subject: [PATCH] goto. back. goback --- stead/goto.lua | 13 ++++++------- stead/stead.lua | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/stead/goto.lua b/stead/goto.lua index d09f965..7f32bc7 100644 --- a/stead/goto.lua +++ b/stead/goto.lua @@ -49,8 +49,7 @@ go = function (self, where, back, forceenter) self.where = deref(where); end - if not jump and (not back or forceenter or - not isDialog(ref(was)) or isDialog(ref(where))) then + if not jump and (not back or forceenter) then v, r = call(ref(where), 'enter', ref(was)); if r == false then self.where = was; @@ -102,6 +101,7 @@ go = function (self, where, back, forceenter) end return res; end +stead.go = go function player_go(self, where) -- cmd iface local w = ref(self.where).way:srch(where); @@ -112,7 +112,7 @@ function player_go(self, where) -- cmd iface end 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; end @@ -122,12 +122,11 @@ end function back() local where = here(); - return me():goto(where.__from__, true); + return me():goto(from(), true); end function goback() - local where = here(); - return me():goto(where.__from__, true, true); + return me():goto(from(), true, true); end 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 end -go = stead.hook(go, function(f, ...) +stead.go = stead.hook(stead.go, function(f, ...) local r,v = f(unpack(arg)) if type(r) == 'string' and cctx() then pr (r) diff --git a/stead/stead.lua b/stead/stead.lua index da2fc68..0f5f696 100644 --- a/stead/stead.lua +++ b/stead/stead.lua @@ -1012,7 +1012,7 @@ function phrase_action(self) r = true; end if isDialog(here()) and not dialog_rescan(here()) then - ret = stead.par(' ', ret, me():back()); + ret = stead.par(' ', ret, me():goto(from(), true)); end ret = stead.par("^^", last, ret); @@ -1271,8 +1271,8 @@ function go(self, where, back) return res; end -function player_goto(self, where) - local v, r = go(self, where, false); +function player_goto(self, where, ...) + local v, r = go(self, where, unpack(arg)); return v, r; end