aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/routesetting.lua11
-rw-r--r--advtrains_interlocking/signal_api.lua7
-rw-r--r--advtrains_interlocking/signal_aspect_accessors.lua2
-rw-r--r--advtrains_interlocking/signal_aspects.lua4
4 files changed, 20 insertions, 4 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index f1b4455..4ce6fd3 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -113,7 +113,7 @@ function ilrs.set_route(signal, route, try)
}
if c_tcbs.signal then
c_tcbs.route_committed = true
- c_tcbs.aspect = route.aspect or advtrains.interlocking.GENERIC_FREE
+ c_tcbs.aspect = route.aspect or advtrains.interlocking.FULL_FREE
c_tcbs.route_origin = signal
advtrains.interlocking.update_signal_aspect(c_tcbs)
signals[#signals+1] = c_tcbs.signal
@@ -138,7 +138,7 @@ function ilrs.set_route(signal, route, try)
if lastsig then
local pos = signals[i]
local _, assigned_by = advtrains.distant.get_main(pos)
- if assigned_by ~= "manual" then
+ if not assigned_by or assigned_by == "routesetting" then
advtrains.distant.assign(lastsig, signals[i], "routesetting")
end
end
@@ -251,6 +251,13 @@ function ilrs.cancel_route_from(sigd)
c_tcbs.route_origin = nil
advtrains.interlocking.update_signal_aspect(c_tcbs)
+ if c_tcbs.signal then
+ local pos = c_tcbs.signal
+ local _, assigned_by = advtrains.distant.get_main(pos)
+ if assigned_by == "routesetting" then
+ advtrains.distant.unassign_dst(pos)
+ end
+ end
c_ts_id = c_tcbs.ts_id
if not c_tcbs then
diff --git a/advtrains_interlocking/signal_api.lua b/advtrains_interlocking/signal_api.lua
index 1fd4e34..eec70f9 100644
--- a/advtrains_interlocking/signal_api.lua
+++ b/advtrains_interlocking/signal_api.lua
@@ -176,6 +176,11 @@ advtrains.interlocking.GENERIC_FREE = {
shunt = false,
dst = false,
}
+advtrains.interlocking.FULL_FREE = {
+ main = -1,
+ shunt = false,
+ proceed_as_main = true,
+}
local function convert_aspect_if_necessary(asp)
if type(asp.main) == "table" then
@@ -212,7 +217,7 @@ end
function advtrains.interlocking.signal_after_dig(pos)
-- clear influence point
- advtrains.interlocking.db.clear_ip_by_signalpos(pos)
+
advtrains.interlocking.signal_clear_aspect(pos)
advtrains.distant.unassign_all(pos, true)
end
diff --git a/advtrains_interlocking/signal_aspect_accessors.lua b/advtrains_interlocking/signal_aspect_accessors.lua
index 02a03ea..bdbb803 100644
--- a/advtrains_interlocking/signal_aspect_accessors.lua
+++ b/advtrains_interlocking/signal_aspect_accessors.lua
@@ -103,9 +103,9 @@ local function set_aspect(pos, asp)
local newasp, aspval = adjust_aspect(pos, asp)
set_supposed_aspect(pos, newasp)
ndef.advtrains.set_aspect(pos, node, aspval)
+ I.signal_on_aspect_changed(pos)
local aspect_changed = A.not_equalp(oldasp, newasp)
if aspect_changed then
- I.signal_on_aspect_changed(pos)
D.update_main(pos)
end
end
diff --git a/advtrains_interlocking/signal_aspects.lua b/advtrains_interlocking/signal_aspects.lua
index 2866ae1..5c4948b 100644
--- a/advtrains_interlocking/signal_aspects.lua
+++ b/advtrains_interlocking/signal_aspects.lua
@@ -32,6 +32,8 @@ local function register_type2(def)
t.label = label
t.main = asp.main
+ t.shunt = asp.shunt
+ t.proceed_as_main = asp.proceed_as_main
mainasps[idx] = t
mainasps[name] = idx
end
@@ -87,6 +89,8 @@ local function type2main_to_type1(name, asp)
local t = {
main = asptbl.main,
+ shunt = asptbl.shunt,
+ proceed_as_main = asptbl.proceed_as_main,
type2name = asp,
type2group = name,
dst = dst,