diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-02-20 11:14:37 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-02-20 11:14:37 +0100 |
commit | e4e76322ba74e1ffb465ca5bbfc420d8857aea01 (patch) | |
tree | a080fcb4b979142f988db7b309dff62131114d7b | |
parent | e97287614cbaf3aa585eae2a92e723f7467bdcc8 (diff) | |
download | advtrains-e4e76322ba74e1ffb465ca5bbfc420d8857aea01.tar.gz advtrains-e4e76322ba74e1ffb465ca5bbfc420d8857aea01.tar.bz2 advtrains-e4e76322ba74e1ffb465ca5bbfc420d8857aea01.zip |
Fix crash when ATC rail exists but no command is saved.
Crash was caused by a concatenation for a debug message. atprint can handle nil if passed as separate parameter
Setting the train's atc command to nil just means that there is no command.
-rw-r--r-- | advtrains/advtrains/atc.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/advtrains/advtrains/atc.lua b/advtrains/advtrains/atc.lua index 5a8e76b..6d484b1 100644 --- a/advtrains/advtrains/atc.lua +++ b/advtrains/advtrains/atc.lua @@ -40,14 +40,14 @@ function atc.send_command(pos, par_tid) advtrains.round_vector_floor_y(train.path[index+train.movedir]) ) advtrains.trains[train_id].atc_command=atc.controllers[pts].command - atprint("Sending ATC Command: "..atc.controllers[pts].command) + atprint("Sending ATC Command: ", atc.controllers[pts].command) return true end end atwarn("ATC rail at", pos, ": Rail not on train's path! Can't determine arrow direction. Assuming +!") advtrains.trains[train_id].atc_arrow=true advtrains.trains[train_id].atc_command=atc.controllers[pts].command - atprint("Sending ATC Command: "..atc.controllers[pts].command) + atprint("Sending ATC Command: ", atc.controllers[pts].command) else atwarn("ATC rail at", pos, ": Sending command failed: The train",train_id,"does not exist. This seems to be a bug.") end |