i once reported that with realistic train acceleration turned on, a train might get stuck at a 45 degree section. i have debugged the code while having such a train on my map and found a possible solution.
here is the savegame:
http://rrs.at/ottd/frozentrain.sav
it contains only ONE train and no other vehicles, this makes it very easy to debug the code. it's the yellow company, just open the train list to jump to the problem. a screenshot is attached. the train is stuck in front of the turn, because the signal was red, when it turned back to green it tries to acellerate, but the routine calculates wrong.
here is why:
in file "train_cmd.c", line 243,
Code: Select all
return (force - resistance) / (mass * 4);
force: 360
resistance: 36
mass: 238
putting these values into the formula, the result is 0,3403....
however the function calculating the acceleration returns an int, so the value is cutted to a zero. the train will never start to move!
my "workaround" solution was
Code: Select all
return max((force - resistance) / (mass * 4), 10);
however, the person who was coding the "realistic train acceleration" thing might look deeper into the problem and find a better solution than this workaround.
bye!