aboutsummaryrefslogtreecommitdiff
path: root/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'trainlogic.lua')
-rw-r--r--trainlogic.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/trainlogic.lua b/trainlogic.lua
index e226eab..1ac5dea 100644
--- a/trainlogic.lua
+++ b/trainlogic.lua
@@ -473,8 +473,8 @@ end
function advtrains.split_train_at_wagon(wagon)
--get train
local train=advtrains.trains[wagon.train_id]
- local pos_for_new_train=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-0.5)]
- local pos_for_new_train_prev=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-1.5)]
+ local pos_for_new_train=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train+wagon.wagon_span)]
+ local pos_for_new_train_prev=advtrains.get_or_create_path(wagon.train_id, train)[math.floor((train.index or 0)-wagon.pos_in_train-1+wagon.wagon_span)]
--before doing anything, check if both are rails. else do not allow
if not pos_for_new_train then