aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-01-22 12:09:59 +0100
committerorwell96 <orwell@bleipb.de>2019-01-22 12:09:59 +0100
commit48e52f054697a4deaf5ac98a3aff9984a63dfa16 (patch)
tree4b51d9782e4955b1ff219a98be14a0cae87c9929 /advtrains
parent64e59b54f880fde044332e23b80aff3e8ce14b15 (diff)
downloadadvtrains-48e52f054697a4deaf5ac98a3aff9984a63dfa16.tar.gz
advtrains-48e52f054697a4deaf5ac98a3aff9984a63dfa16.tar.bz2
advtrains-48e52f054697a4deaf5ac98a3aff9984a63dfa16.zip
Revert "Index NaN check (tracking obscure error detected on LW migration)"
This reverts commit e915b61da6f18efa49b6afacb7e9ca181d59cc5c.
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/trainlogic.lua10
1 files changed, 1 insertions, 9 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 393e1a7..c129409 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -458,16 +458,8 @@ function advtrains.train_step_b(id, train, dtime)
end
--- 4. move train ---
- local oi = train.index
+
train.index=train.index and train.index+((train.velocity/(train.path_dist[math.floor(train.index)] or 1))*dtime) or 0
- if train.index ~= train.index then -- This is a check whether index is "NaN" https://stackoverflow.com/questions/37753694/lua-check-if-a-number-value-is-nan
- atwarn("Index of train is NaN!")
- advtrains.path_print(train, atwarn)
- atwarn("Calculation index=",oi,"+(",train.velocity,"/",train.path_dist[math.floor(train.index)],"*",dtime)
- advtrains.path_invalidate(train)
- train.wait_for_path = true
- return
- end
recalc_end_index(train)
end