ts2 / ts2-sim-server

TS2 SimServer, the core of the TS2 Simulator
https://ts2.github.io
GNU General Public License v2.0
5 stars 9 forks source link

fix: trains do not depart if timefactor is 1x #45

Closed hklang10 closed 4 years ago

hklang10 commented 4 years ago

44

When timefactor = 1x, t.StoppedTime was always zero, so train did not depart.

t.StoppedTime type now float64 (was type int).

When 1x, t.StoppedTime increment value is 0.5 seconds, so rounded to zero.

codecov[bot] commented 4 years ago

Codecov Report

Merging #45 into master will decrease coverage by 0.05%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
- Coverage   76.48%   76.43%   -0.06%     
==========================================
  Files          38       38              
  Lines        2586     2597      +11     
==========================================
+ Hits         1978     1985       +7     
- Misses        486      489       +3     
- Partials      122      123       +1
Impacted Files Coverage Δ
simulation/trains.go 59.94% <0%> (ø) :arrow_up:
simulation/routes.go 88.61% <0%> (-1.63%) :arrow_down:
plugins/points/points.go 71.42% <0%> (+6.72%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 239521a...f35868a. Read the comment docs.

npiganeau commented 4 years ago

Thanks for your PR. Can you change it to have stoppedTime as time.Duration instead ? This way we don't need to cast to int or float and don't need to divide by seconds either.

hklang10 commented 4 years ago

ok, I will push again from another branch

hklang10 commented 4 years ago

closed, new pr is #46 on another branch.