aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/occupation.lua2
-rw-r--r--advtrains/path.lua7
2 files changed, 7 insertions, 2 deletions
diff --git a/advtrains/occupation.lua b/advtrains/occupation.lua
index 20a986e..66ad36c 100644
--- a/advtrains/occupation.lua
+++ b/advtrains/occupation.lua
@@ -103,7 +103,9 @@ function o.clear_all_items(train_id, pos)
local t = occget(pos)
if not t then return end
local i = 1
+ local _cnt = 0
while t[i] do
+ _cnt = _cnt + 1; if _cnt > 10000 then error("Loop trap in advtrains.occ,clear_all_items was triggered!") end
if t[i]==train_id then
table.remove(t, i)
table.remove(t, i)
diff --git a/advtrains/path.lua b/advtrains/path.lua
index 4807361..84d295d 100644
--- a/advtrains/path.lua
+++ b/advtrains/path.lua
@@ -112,14 +112,17 @@ end
-- before returning from the calling function.
function advtrains.path_invalidate(train, ignore_lock)
if advtrains.lock_path_inval and not ignore_lock then
- atwarn("Train ",train.train_id,": Illegal path invalidation has occured during train step:")
+ atwarn("Train ",train.id,": Illegal path invalidation has occured during train step:")
atwarn(debug.traceback())
end
-
if train.path then
+ --atdebug("path_invalidate for",train.id)
+ local _cnt = 0
for i,p in pairs(train.path) do
+ _cnt = _cnt + 1; if _cnt > 10000 then error("Loop trap in advtrains.path_invalidate was triggered!") end
advtrains.occ.clear_all_items(train.id, advtrains.round_vector_floor_y(p))
end
+ --atdebug("occ cleared")
end
train.path = nil
train.path_dist = nil