aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r--advtrains/trainlogic.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 2c2e247..c39cc7a 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -892,8 +892,10 @@ function advtrains.spawn_wagons(train_id)
end
end
-function advtrains.split_train_at_fc(train)
- -- splits train at first different current FC
+function advtrains.split_train_at_fc(train, count_empty)
+ -- splits train at first different current FC by convention,
+ -- locomotives have empty FC so are ignored
+ -- count_empty is used to split off locomotives
local train_id = train.id
local fc = false
local ind = 0
@@ -902,7 +904,7 @@ function advtrains.split_train_at_fc(train)
local data = advtrains.wagons[w_id]
if data then
local wfc = advtrains.get_cur_fc(data)
- if wfc ~= "" then
+ if wfc ~= "" or count_empty then
if fc then
if fc ~= wfc then
ind = i