diff options
author | orwell <orwell@bleipb.de> | 2025-01-09 00:57:32 +0100 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2025-01-09 08:38:09 +0100 |
commit | 8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c (patch) | |
tree | c5915919c6efe856207d136404846f6ed86670ae /advtrains_interlocking | |
parent | 9bd34f738663cdc268db6399ecb6aaba2d4c9a28 (diff) | |
download | advtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.tar.gz advtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.tar.bz2 advtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.zip |
Various bugfixes found in lunixforks debug
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r-- | advtrains_interlocking/database.lua | 9 | ||||
-rw-r--r-- | advtrains_interlocking/route_ui.lua | 2 | ||||
-rw-r--r-- | advtrains_interlocking/routesetting.lua | 9 | ||||
-rw-r--r-- | advtrains_interlocking/signal_api.lua | 1 | ||||
-rwxr-xr-x | advtrains_interlocking/tcb_ts_ui.lua | 5 |
5 files changed, 17 insertions, 9 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua index 9c72a72..d80fb76 100644 --- a/advtrains_interlocking/database.lua +++ b/advtrains_interlocking/database.lua @@ -84,7 +84,7 @@ function ildb.load(data) if pos then -- that was a pos_to_string local epos = advtrains.encode_pos(pos) - --atdebug("ILDB converting TCB position format",pts,"->",epos) + atdebug("ILDB converting TCB position format",pts,"->",epos) track_circuit_breaks[epos] = tcb else -- keep entry, it is already new @@ -100,7 +100,7 @@ function ildb.load(data) local lpos = minetest.string_to_pos(lpts) if lpos then local epos = advtrains.encode_pos(lpos) - --atdebug("ILDB converting tcb",pts,"side",t_side,"route",t_route,"lock position format",lpts,"->",epos) + atdebug("ILDB converting tcb",pts,"side",t_side,"route",t_route,"lock position format",lpts,"->",epos) locks_n[epos] = state else -- already correct format @@ -131,7 +131,7 @@ function ildb.load(data) if pos then -- that was a pos_to_string local epos = advtrains.encode_pos(pos) - --atdebug("ILDB converting Route Lock position format",pts,"->",epos) + atdebug("ILDB converting Route Lock position format",pts,"->",epos) advtrains.interlocking.route.rte_locks[epos] = lta else -- keep entry, it is already new @@ -412,6 +412,7 @@ function ildb.check_and_repair_ts_at_pos(pos, tcb_connid, notify_pname, force_cr return ildb.repair_ts_merge_all(all_tcbs, force_create, notify_pname) end --tsrepair_notify(notify_pname, "Found section", ts.name or ts_id, "here.") + ildb.update_rs_cache(ts_id) return ts_id end @@ -457,7 +458,7 @@ function ildb.get_all_tcbs_adjacent(inipos, inidir, per_track_callback) pos, connid = ti:next_branch() --atdebug("get_all_tcbs_adjacent: BRANCH: ",pos, connid) bconnid = nil - is_branch_start = true + local is_branch_start = true repeat -- callback if per_track_callback then diff --git a/advtrains_interlocking/route_ui.lua b/advtrains_interlocking/route_ui.lua index 7dddc6e..3c7bd64 100644 --- a/advtrains_interlocking/route_ui.lua +++ b/advtrains_interlocking/route_ui.lua @@ -67,7 +67,7 @@ function atil.show_route_edit_form(pname, sigd, routeid, sel_rpartidx) if c_rseg.locks then for pts, state in pairs(c_rseg.locks) do - local pos = minetest.string_to_pos(pts) + local pos = advtrains.decode_pos(pts) itab(i, "L "..pts.." -> "..state, "lock", pos) if not advtrains.is_passive(pos) then itab(i, "-!- No passive component at "..pts..". Please reconfigure route!", "err", nil) diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua index 28c8c3c..0668e62 100644 --- a/advtrains_interlocking/routesetting.lua +++ b/advtrains_interlocking/routesetting.lua @@ -104,7 +104,7 @@ function ilrs.set_route(signal, route, try) end for lp, state in pairs(c_locks) do - local confl = ilrs.has_route_lock(pts, state) + local confl = ilrs.has_route_lock(lp, state) local pos = advtrains.decode_pos(lp) if advtrains.is_passive(pos) then @@ -131,7 +131,8 @@ function ilrs.set_route(signal, route, try) local nvar = c_rseg.next if nvar then local re_tcbs = ildb.get_tcbs({p = nvar.p, s = (nvar.s==1) and 2 or 1}) - if not re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id then + if (not re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id) + and route[i+1] then --FIX 2025-01-08: in old worlds the final TCB may be wrong (it didn't matter back then), don't error out here (route still shown invalid in UI) if not try then atwarn("Encountered inconsistent ts (front~=back) while a real run of routesetting routine, at position",pts,"while setting route",rtename,"of",signal) end return false, "TCB at "..minetest.pos_to_string(nvar.p).." has different section than previous TCB. Please update track section or reconfigure route!" end @@ -413,7 +414,9 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel) -- set_route now sets the signal aspects --has_changed_aspect = true -- route success. apply default_autoworking flag if requested - tcbs.route_auto = route.default_autoworking + if route.default_autoworking then + tcbs.route_auto = true --FIX 2025-01-08: never set it to false if it was true! + end end end if has_changed_aspect then diff --git a/advtrains_interlocking/signal_api.lua b/advtrains_interlocking/signal_api.lua index b607750..e92658d 100644 --- a/advtrains_interlocking/signal_api.lua +++ b/advtrains_interlocking/signal_api.lua @@ -375,6 +375,7 @@ function signal.reapply_aspect(pts) local rem_aspt = signal.aspects[remote] --atdebug("resolving remote",advtrains.decode_pos(remote),"aspt",rem_aspt) local rem_pos = advtrains.decode_pos(remote) + local _,rem_ndef rem_masp, _, _, rem_ndef = signal.get_aspect_internal(rem_pos, rem_aspt) if rem_masp then if rem_ndef.advtrains and rem_ndef.advtrains.get_aspect_info then diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 59d3be4..814a11a 100755 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -776,7 +776,7 @@ function advtrains.interlocking.check_route_valid(route, sigd) if c_rseg.locks then for pts, state in pairs(c_rseg.locks) do - local pos = minetest.string_to_pos(pts) + local pos = advtrains.decode_pos(pts) if not advtrains.is_passive(pos) then return false, "No passive component for lock at "..pts end @@ -795,6 +795,9 @@ function advtrains.interlocking.check_route_valid(route, sigd) i = i + 1 end -- check end TCB + if not c_sigd then + return false, "Final TCBS unset (legacy-style buffer route)" + end c_tcbs = ildb.get_tcbs(c_sigd) if not c_tcbs then return false, "Final TCBS missing at "..sigd_to_string(c_sigd) |