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: Build train locomotive filter #8733

Open
wants to merge 1 commit into
base: master
from

Conversation

@perezdidac
Copy link
Contributor

@perezdidac perezdidac commented Feb 23, 2021

Motivation / Problem

When creating a train, there is no way of filtering by engines, given that the 'None' cargo filter removes all engines that also carry cargo, typically passengers and mail. As a player, I want to be able to see all the available engines regardless of whether they can carry cargo or not. This is especially helpful when creating passenger trains.

Description

This PR adds a new filter in the train vehicle window drop down menu so in addition to (1) any cargo, (2) no cargo, and (3) a specific cargo, players can also filter by engines only, regardless of whether they carry cargo or not.

This is how it looks, observe that some of the engines can carry passengers, like the selected one:

image

Note that

static const CargoID CF_ANY     = CT_NO_REFIT;   ///< Show all vehicles independent of carried cargo (i.e. no filtering)
static const CargoID CF_NONE    = CT_INVALID;    ///< Show only vehicles which do not carry cargo (e.g. train engines)
static const CargoID CF_ENGINES = CT_AUTO_REFIT; ///< Show only engines (for rail vehicles only)

seems a little hacky to me, so I just reused the same pattern using CT_AUTO_REFIT as there wasn't a better option.

Limitations

N/A

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 affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
@perezdidac perezdidac marked this pull request as ready for review Feb 23, 2021
@perezdidac
Copy link
Contributor Author

@perezdidac perezdidac commented Feb 27, 2021

Hi! Anyone could review? It'd be nice to add the Preview tag so people can try this out on their browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant