aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/atc_rail.lua
diff options
context:
space:
mode:
authorMaverick2797 <git.maverick2797@gmail.com>2021-11-08 20:36:01 +0800
committerGabriel PĂ©rez-Cerezo <gabriel@gpcf.eu>2021-11-08 22:58:23 +0100
commit4cf9e5283b8710c08e22fd4786d48f9264298d87 (patch)
tree0e623f59bb612c434987b29f8d603e2e9ca11c7b /advtrains_luaautomation/atc_rail.lua
parent45e18326e34537973a4c88a26ad8991e3935d384 (diff)
downloadadvtrains-4cf9e5283b8710c08e22fd4786d48f9264298d87.tar.gz
advtrains-4cf9e5283b8710c08e22fd4786d48f9264298d87.tar.bz2
advtrains-4cf9e5283b8710c08e22fd4786d48f9264298d87.zip
split_at_index where index=1
Splitting at index=1 results in multiple empty trains being created. Can be prevented by an atc_speed > 0 check by the user, but easier just to return false and do nothing.
Diffstat (limited to 'advtrains_luaautomation/atc_rail.lua')
-rwxr-xr-x[-rw-r--r--]advtrains_luaautomation/atc_rail.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua
index bfd7357..6c157e3 100644..100755
--- a/advtrains_luaautomation/atc_rail.lua
+++ b/advtrains_luaautomation/atc_rail.lua
@@ -56,7 +56,7 @@ function r.fire_event(pos, evtdata, appr_internal)
split_at_index = function(index, cmd)
if not train_id then return false end
assertt(cmd, "string")
- if type(index) ~= "number" then
+ if type(index) ~= "number" or index < 2 then
return false
end
local new_id = advtrains.split_train_at_index(train, index)