Skip to content

Fix: multiple issues with TFO#609

Merged
leezer3 merged 6 commits intoleezer3:masterfrom
s520:FixTFO_2
Apr 25, 2021
Merged

Fix: multiple issues with TFO#609
leezer3 merged 6 commits intoleezer3:masterfrom
s520:FixTFO_2

Conversation

@s520
Copy link
Contributor

@s520 s520 commented Apr 20, 2021

This PR fixes multiple issues with TFO.

  • Change: the TFO operation plan to be calculated only when reading the route
    • Previously, if the player jumped between stations, it would be calculated again.
  • Fix: the method of calculating the acceleration of TFO

I'm currently working on fixing #598.

UPDATE: 2021/04/21

@s520
Copy link
Contributor Author

s520 commented Apr 21, 2021

#598 was a problem due to the position of RailEnd on Route CSV and <Point> on TFO.
Block with RailEnd is Invalid TrackElement.
If TFO switches the rail index of TrackFollower to the rail where RailEnd is written, the behavior of TrackFollower is broken because TrackFollower moving backward doesn't consider Invalid TrackElement.

We need to find out that this change does not destroy anything else.

@leezer3
Copy link
Owner

leezer3 commented Apr 21, 2021

I don't think it should.

The original code only uses TrackFollowers on Rail0.
We've added multiple rails to the equation, and this / the TrackFollowerFunction are the only places that use it.

Possibly need to think about junctions though.
#329

That is an incomplete branch, but perhaps we need to think about a RailIndexChange event, as opposed to switching then in the TFO itself?

@s520
Copy link
Contributor Author

s520 commented Apr 21, 2021

Hmm... I'll have a look at that branch and think about it.

@leezer3
Copy link
Owner

leezer3 commented Apr 21, 2021

It's not so much for this bug fix, as opposed to a later improvement.
(and the branch is seriously out of date with master)

The switch logic would need to be coded into the routefile, and then I suppose you would need time based switch events (?) in the TFO plan to set them as appropriate, and then reset afterwards.
The advantage would be getting the sim closer to operating as per a 'real' railway, bit on the flip side it'd require a rework of the TFO concept & likely not be backwards compatible.

@s520
Copy link
Contributor Author

s520 commented Apr 25, 2021

I feel bad. I can not grasp the intent of your remarks.
Are you negative to fd34644 itself, or are you negative because it may affect more than just TFO?

@leezer3
Copy link
Owner

leezer3 commented Apr 25, 2021

None if those, nothing wrong with your code I can see.

I was referring to the potential effects of the linked incomplete branch.

@s520
Copy link
Contributor Author

s520 commented Apr 25, 2021

Thank you. I seem to have misunderstood.

I have fixed the additional issue pointed out here.

@s520 s520 marked this pull request as ready for review April 25, 2021 08:22
@leezer3
Copy link
Owner

leezer3 commented Apr 25, 2021

No problem, thanks :)

@s520
Copy link
Contributor Author

s520 commented Apr 25, 2021

I forgot to uncomment the test.
This PR is now ready for review.
Please review it.

@leezer3 leezer3 merged commit 9f6ab60 into leezer3:master Apr 25, 2021
@leezer3
Copy link
Owner

leezer3 commented Apr 25, 2021

I've added a couple of small improvements:
ebad2e4
fbf1d43

These are intended to address the following situation:
A train contains a train.dat file, but which has an unrecognised BVE format string in. (I'm not aware of any, but I've only found about 2 of the BVE1210000 format files, and I don't want to rule out others, especially as my collection is more Western focused)
With the changes from this PR, we completely failed to load the train & subsequently crashed attempting to assign AI.

The first disables the start panel if the train format is unsupported.
The second adds another format- UnknownBVE & converts the new function into an enum return as opposed to a void (neater I think).

It might want a check for non-zero cars / handles here, or a check that the loading of the train succedded:
https://github.com/leezer3/OpenBVE/blob/master/source/OpenBVE/System/Loading.cs#L299

@s520
Copy link
Contributor Author

s520 commented Apr 28, 2021

I see. Thank you for fixing it.

@s520 s520 deleted the FixTFO_2 branch April 28, 2021 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Minor]TFO: motor sound problem [TrackFollowingObject]The object goes off the rail

2 participants