From aa16d66acf1f3e6ce906e12258146762a7fbd054 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Fri, 2 Jul 2010 04:34:12 +0000
Subject: [PATCH] visited added
---
stead/goto.lua | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/stead/goto.lua b/stead/goto.lua
index a0db3b0..25e4cb7 100644
--- a/stead/goto.lua
+++ b/stead/goto.lua
@@ -85,6 +85,11 @@ go = function (self, where, back)
v = call(ref(to), 'entered', ref(was));
stead.in_entered_call = false
res = par('^^',res,v);
+ if tonumber(ref(to).__visited) then
+ ref(to).__visited = ref(to).__visited + 1;
+ elseif here().__visited == nil then
+ ref(to).__visited = 1
+ end
end
PLAYER_MOVED = true
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
@@ -94,6 +99,15 @@ go = function (self, where, back)
return res;
end
+function visited(w)
+ if not w then w = here() end
+ w = ref(w)
+ if not isRoom(w) then
+ error ("Wrong parameter to visited.", 2);
+ end
+ return w.__visited
+end
+
iface.fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed state (main win), move -- loc changed
local l
if st then