Changelog:
v2:
Now shows maximum speed with fully loaded wagons instead of wagons in current state (i.e. usually unloaded)
Cleanup: Moved code common to calculating train acceleration and estimating max speed to helper functions to avoid code duplication
Since the maximum speed of the train is valid only for the engine itself + maybe few wagons and real maximum speed depend on how much wagons is appended, decision of how many wagons you can append to engine and still maintain reasonable speed is then based only on rough guess. You overdo it, and the train will crawl. This way you can watch the real max. speed while buying wagons and stop when it dropt to values unacceptable fro you
For example for Chimaera with 50 armored wagons it will say Max. speed: 640 km/h (614 km/h)
And 614km/h is the real maximum speed on flat surface, as with so many wagons, the train won't go faster.
This is not fully finished, but it is working (you can see the max. speed in train details)
What should be fixed/improved:
- Determine why the calculation is 1-3 km/h higher than reality and fix it. Probably some rounding error.
- Calculate the speed by solving equation "force - resistance = 0", instead of trying increasing speed and recomputing while "force > resistance".
- Place the real. max speed so the text will not overflow the window width