News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Trains sometimes takes a tile more

Started by pletiplot, June 01, 2009, 09:45:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pletiplot

Hi. I have very complex saegame and there I sometimes experience, that a train is longer than it should be. The train have one BR 155 engine and 13 Goods Flachwagen. The declared length is 7 tiles. The most of the trains are that length but sometimes appears one or two, which takes a tile more. The tile is usualy in a crossings just before the station and block the track for all trains. The trian takes a tile more at all stations it stops. The only help is to send it to depot and dissasemble it. I can send a savegame, but it is a bit big.

Combuijs

I've noticed that one too! I just add an extra tracktile to the station to avoid problems. The train will load 100% in these cases, so every wagon is inside the station, but the track behind it just stays reserved.
Bob Marley: No woman, no cry

Programmer: No user, no bugs



prissi

This is due to the internal movement code. Any fix to this has 1001 error in other places.

whoami

How about working around this by changing the display of (the number of) required tiles in the depot, only for those cases where it is needed?

pletiplot

I did some experiments. The problem is a property of train (convoy). If a trains "overtakes" in one station, it will do it everywhere. When I send the train to the depot, remove the last wagon and then put it back, the train got repaired. MAybe you coud add some "just stopped" test, which could re-count the tiles and free the last one, if it is overstepped.

prissi

The problem should occur only in north and east directions, but not south or west.

z9999

But why this problem doesn't happen to all same convoi ?
Front convoi of attached image doesn't have problem. Only this convoi turned direction.

I think older version of simutrans didn't have this problem.
So, this should be a bug.

Dwachs

Does this help?


Index: simconvoi.cc
===================================================================
--- simconvoi.cc        (revision 2615)
+++ simconvoi.cc        (working copy)
@@ -589,7 +589,7 @@
                                // now actually move the units
                                while(sp_soll>>12) {
                                        uint32 sp_hat = fahr[0]->fahre_basis(1<<12);
-                                       int v_nr = get_vehicle_at_length((steps_driven++)>>4);
+                                       int v_nr = get_vehicle_at_length((++steps_driven)>>4);
                                        // stop when depot reached
                                        if(state==INITIAL) {
                                                break;
Parsley, sage, rosemary, and maggikraut.

gerw

At least for me, it does! How do you found this? :award:

z9999

Thank you. It solved my problem above.

Maybe, we confounded this topic's problem with old known problem. :)

Dwachs

Parsley, sage, rosemary, and maggikraut.

prissi

This looks good, although I did not look at the code for a month or so, so everything is from memory. I suppose this is the problem with 127/255 internal steps, which of course do not match, especially with the above wrong statement. Better to do this in two lines anyway, I suppose.

z9999

This patch had been denied ?
Someone will write a different solution to solve this problem ?

Dwachs

I don't know. It would be the first one to be proud member of "denied patches" board :)
Parsley, sage, rosemary, and maggikraut.

prissi

The bug with too short trains at a signal is unsolved,obviously. However, please, Dwachs you can submit too. Please submit your own bugfixes.

Dwachs

Parsley, sage, rosemary, and maggikraut.