The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: CK on January 19, 2022, 04:21:02 PM

Title: [Convoy] All trams on map get negative speed, unable to move
Post by: CK on January 19, 2022, 04:21:02 PM
In my game which started in 1950 and went on into 1993 all trams (even on unlinked tracks) suddenly went to a negative speed where they're unable to move. Clicking the schedule button to make them recalculate their route did not help. If a bit of track that is reserved is clicked it shows some insanely large figure for speed for the reserving vehicle suggesting that some kind of integer/buffer overflow is taking place. Restarting the vehicle by clicking the schedule button and then closing the window works intermittently. I have no idea how to reproduce it. I've tried running a circuit with similar trams in a separate save and the fault did not develop.

I'm on the latest build (c5c9a97 as of today) and here is my save
https://ufile.io/frcdtvlk
Title: Re: [Convoy] All trams on map get negative speed, unable to move
Post by: Ranran(retired) on January 19, 2022, 07:05:53 PM
Oh, maybe this issue is involved.
https://forum.simutrans.com/index.php/topic,21334.msg198466.html

EDIT:
Ahh, I thought it was just an error in the expression and fixed it, but the variables were also wrong.
max_speed_drive_by_sight_tram must be max_speed_drive_by_sight_tram_kmh.

file->rdwr_long(max_speed_drive_by_sight_tram_kmh);
max_speed_drive_by_sight_tram = kmh_to_speed(max_speed_drive_by_sight_tram_kmh);
Title: Re: [Convoy] All trams on map get negative speed, unable to move
Post by: Ranran(retired) on January 19, 2022, 09:01:52 PM
I have pull-requested a countermeasure to this. #471.
However, tram that is already behaving strangely needs to be rescheduled. Is it possible to improve this further?
The fix is to replace the default values to fix the broken setting values.
Anyway, I didn't implement this so I don't know much about how it works. There may be a better solution. Please check again.
Title: Re: [Convoy] All trams on map get negative speed, unable to move
Post by: jamespetts on January 20, 2022, 03:16:03 PM
This fix, together with a supplemental fix, have been implemented on the current nightly - I should be grateful if people could confirm whether this is now working.
Title: Re: [Convoy] All trams on map get negative speed, unable to move
Post by: CK on January 22, 2022, 07:29:19 PM
It hasn't occurred since the update so I assume it's been fixed now.