The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: pletiplot on June 01, 2009, 09:45:22 pm

Title: Trains sometimes takes a tile more
Post by: pletiplot on June 01, 2009, 09:45:22 pm
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.
Title: Re: Trains sometimes takes a tile more
Post by: Combuijs on June 02, 2009, 07:06:30 am
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.
Title: Re: Trains sometimes takes a tile more
Post by: prissi on June 03, 2009, 09:50:16 pm
This is due to the internal movement code. Any fix to this has 1001 error in other places.
Title: Re: Trains sometimes takes a tile more
Post by: whoami on June 04, 2009, 07:43:50 pm
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?
Title: Re: Trains sometimes takes a tile more
Post by: pletiplot on June 05, 2009, 09:24:31 pm
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.
Title: Re: Trains sometimes takes a tile more
Post by: prissi on June 06, 2009, 08:31:04 pm
The problem should occur only in north and east directions, but not south or west.
Title: Re: Trains sometimes takes a tile more
Post by: z9999 on August 26, 2009, 07:18:26 pm
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.
Title: Re: Trains sometimes takes a tile more
Post by: Dwachs on August 28, 2009, 12:03:10 pm
Does this help?

Code: [Select]
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;
Title: Re: Trains sometimes takes a tile more
Post by: gerw on August 28, 2009, 01:54:47 pm
At least for me, it does! How do you found this? :award:
Title: Re: Trains sometimes takes a tile more
Post by: z9999 on August 28, 2009, 01:55:51 pm
Thank you. It solved my problem above.

Maybe, we confounded this topic's problem with old known problem (http://archive.forum.simutrans.com/topic/07246.0/index.html). :)
Title: Re: Trains sometimes takes a tile more
Post by: Dwachs on August 28, 2009, 06:07:47 pm
Lets wait for prissi's opinion  8)
Title: Re: Trains sometimes takes a tile more
Post by: prissi on September 02, 2009, 12:59:08 pm
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.
Title: Re: Trains sometimes takes a tile more
Post by: z9999 on September 10, 2009, 08:40:10 am
This patch had been denied ?
Someone will write a different solution to solve this problem ?
Title: Re: Trains sometimes takes a tile more
Post by: Dwachs on September 10, 2009, 10:17:18 am
I don't know. It would be the first one to be proud member of "denied patches" board :)
Title: Re: Trains sometimes takes a tile more
Post by: prissi on September 10, 2009, 12:34:38 pm
The bug with too short trains at a signal is unsolved,obviously. However, please, Dwachs you can submit too. Please submit your own bugfixes.
Title: Re: Trains sometimes takes a tile more
Post by: Dwachs on September 10, 2009, 06:57:46 pm
incorporated in 2644.