Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Engine expiry setting to keep owned engines available for purchase #12599

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

2TallTyler
Copy link
Member

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.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@frosch123
Copy link
Member

I do not quite understand from the diff, how this works.

What happens when the last vehicle is sold?

  • If the engine is past phase 3: does the engine immediately become unavailable?
  • If the engine is in phase 3: does the engine immediately drop in reliability?

@2TallTyler
Copy link
Member Author

The behavior of selling the last vehicle is identical to what currently happens if Vehicles never expire is disabled. The specifics of that behavior are a bit beyond my understanding. 🙂

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.

None yet

3 participants