Feature: Engine expiry setting to keep owned engines available for purchase #12599
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
@andythenorth and others want to roleplay with their favorite trains forever, yet continue the passage of time.
We have "vehicles never expire" for this, but it's too big a hammer with a GRF like Iron Horse.
Description
Extend the vehicle expiry setting to add a third option: Engines that are owned by any company remain available for purchase, while unowned vehicles expire normally.
While I'm renaming things, this setting is about engine expiry, not vehicle expiry. 😃
Limitations
Iterating through all vehicles every time
CalcEngineReliability()
is called feels expensive. We should probably cache a list of currently-owned engines and update it using a timer, once per economy month (about a minute). I could use some help determining the proper way to do this. 🙂Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.