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.
This commit is contained in:
orwell96 2017-02-20 11:14:37 +01:00
parent e97287614c
commit e4e76322ba
1 changed files with 2 additions and 2 deletions

View File

@ -40,14 +40,14 @@ function atc.send_command(pos, par_tid)
advtrains.round_vector_floor_y(train.path[index+train.movedir]) advtrains.round_vector_floor_y(train.path[index+train.movedir])
) )
advtrains.trains[train_id].atc_command=atc.controllers[pts].command 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 return true
end end
end end
atwarn("ATC rail at", pos, ": Rail not on train's path! Can't determine arrow direction. Assuming +!") 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_arrow=true
advtrains.trains[train_id].atc_command=atc.controllers[pts].command 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 else
atwarn("ATC rail at", pos, ": Sending command failed: The train",train_id,"does not exist. This seems to be a bug.") atwarn("ATC rail at", pos, ": Sending command failed: The train",train_id,"does not exist. This seems to be a bug.")
end end