leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
281 stars 51 forks source link

Track Name behaviors between switch and switchT #1021

Closed Kenny-Hui closed 6 months ago

Kenny-Hui commented 7 months ago

Description

In a switch command, the following works as intended: .switch 0;2;0;;Crossing;Track 0;Track 2 The switch name is "Crossing", the first rail (0) is named "Track 0" and the latter is named "Track 2".

This is however inverted when using switchT: .switchT 0;2;0;;Crossing;Track 0;Track 2 The switch name is "Crossing", the first rail (0) is named "Track 2" and the latter is named "Track 0" as availableTracks are added in different order depending on whether it's trailing or not: https://github.com/leezer3/OpenBVE/blob/dcc27a54d9934da004a3b773bb616f403d7049c0/source/Plugins/Route.CsvRw/CsvRwRouteParser.ApplyRouteData.cs#L602

https://github.com/leezer3/OpenBVE/blob/dcc27a54d9934da004a3b773bb616f403d7049c0/source/Plugins/Route.CsvRw/CsvRwRouteParser.ApplyRouteData.cs#L617

BPI-919 commented 7 months ago

@leezer3 : Is this kind of bug still present in the latest build? 😁 Because if not, I will experiment with the Switch(T) command, too.

leezer3 commented 6 months ago

OK, try that.

The track names probably ought to be stored in a dictionary with the key being the set rail index, but for the moment I've reversed them to sort this.

@BPI-919 I think all glitches should probably be minor now. However, please note that travelling on tracks other than Rail0 (especially on a curve) may not be totally smooth, as we don't calculate curve radii or anything at the minute. Basically, in it's current state, this is useful for things like sidings or parallel platforms, rather than truly complex stuff.

Kenny-Hui commented 6 months ago

Seems to be resolved as of the latest Nightly Build