Skip to main content
Topic: [Bug] Trains are squashed together on leaving a depot (Read 8112 times) previous topic - next topic

[Bug] Trains are squashed together on leaving a depot

When a train leaves a depot, very often, a great many of the carriages are squashed together until the train next turns around. The below two screenshots are an example: the first is the train (consisting of a locomotive and four carriages) leaving the depot, and the second is the same train after it has turned around at the end of the track (it was set with a schedule to travel between two waypoints).

The screenshots come from the latest nightly binary, the one with four different version numbers, but the date of the 28th of February 2009.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #1
Usually this happens only when there is a signal or waypoint on a tile directly before the depot.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #2
Usually this happens only when there is a signal or waypoint on a tile directly before the depot.

Aha, thank you for the information! There was indeed a waypoint on the adjacent tile...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #3
Does this small patch help? I did not test it that much, but afaict trains leaving depot are now rearranged at the waypoints. In fact, they are jumping some space in front. Dont know what happens at signals near depots...
Parsley, sage, rosemary, and maggikraut.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #4
Dwachs,

it works, thank you! But, may I ask - why the empty

Code: [Select]
else {
}

statement?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #5
But this solution has the problem, taht a train will jump through a signal and a waiting train and will cause havock. Imho, the only way out would a proper check for too long trains for leaving ...

Re: [Bug] Trains are squashed together on leaving a depot

Reply #6
Prissi,

ahh, thank you for spotting that. Pity that it causes further problems...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #7
@James: the empty statement was planned to be not empty :) but never got filled.

@Prissi: The motivation for this patch was that in the code there are several statement (steps_driven>=0 ? LEAVING_DEPOT : DRIVING). However steps_driven is always -1 (?).
Parsley, sage, rosemary, and maggikraut.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #8
But this solution has the problem, taht a train will jump through a signal and a waiting train and will cause havock. Imho, the only way out would a proper check for too long trains for leaving ...

This happens also with long trains entering a too short station. If the route on which they leave is different from the route on which they came, the trains are jumping.

Would this help: when the train is reversed in a station move it only to the last common tile of the both routes (new and old) or only to the beginning of the station? Then probably some trailers of the train are off-track, but this happens also if trains have to change their route caused by a change in the track layout, so might be of less harm?

Edit: Another proposal: If a train has to reverse direction in a station but the train is longer than the station then treat the train as it would leave a depot at the end of the station. Patch attached.
Parsley, sage, rosemary, and maggikraut.

[r2621] Making train be shorter then it should be.

Reply #9
This bug is pretty easy to reproduce, and has huge consequences.

1. Make depot with signal that would block leaving train - for example station choose signal.
2. Make sure that there is enough free space between signal and next blocked title for train to fill.
3. Build the train and send it from depot.
4. Make sure it stops before signal while part of train is still inside depot.
5. Release route.

as you see, now train is as long as part between signal and depot. Not only it looks smaller, but it also acts as if it was smaller: it will release locks after last wagon, rather then after it's real length.

http://www.ii.uj.edu.pl/~szklarze/simscr54.png
http://www.ii.uj.edu.pl/~szklarze/simscr53.png

moderator's note: merged with existing topic --whoami

Re: [r2621] Making train be shorter then it should be.

Reply #10
This is a long-known bug.

I once posted a patch for it:
http://forum.simutrans.com/index.php?topic=1609.msg16673#msg16673

The trains get repaired though if they have to turn around.
Parsley, sage, rosemary, and maggikraut.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #11
Needs to be looked at it again to find out, which has less severe consequeces. ut there was also the idea to display a not route in such circumstances.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #12
This is now checked more thouroughly in the recent nightlies. It should not lead to jumping trains on diagonals, please test this.

Re: [Bug] Trains are squashed together on leaving a depot

Reply #13
NObody complains about it => closing