Skip to content

Allow filtering the vehicle list by station#997

Merged
AaronVanGeffen merged 9 commits intoOpenLoco:masterfrom
AaronVanGeffen:ui/vehicles-stopping-at
Jun 26, 2021
Merged

Allow filtering the vehicle list by station#997
AaronVanGeffen merged 9 commits intoOpenLoco:masterfrom
AaronVanGeffen:ui/vehicles-stopping-at

Conversation

@AaronVanGeffen
Copy link
Copy Markdown
Member

@AaronVanGeffen AaronVanGeffen commented Jun 15, 2021

On advanced scenarios, the list of vehicles can get very long, making vehicle management more cumbersome than needed. This PR introduces basic filtering of the vehicle list by station or cargo

To do this, the window currently looks at whether a station window is open, and filters by that window's station id. Ideally, the user would be able to select a station via the UI. However, there can be 1024 stations in any given game, so I think this is a nice compromise.

While currently the filtering is enabled at all times, I would like to extend this so the player can opt-in to the filter instead. Perhaps we can offer a cargo filter as well (with a dropdown, up to 32 options).

Showing all vehicles:
Screenshot (3)

Filtering by a particular station (by open station window):
Screenshot (4)

Filtering by particular cargo:
Screenshot (5)

@TrevorCash
Copy link
Copy Markdown

TrevorCash commented Jun 15, 2021

I think a really useful feature along these lines would be filtering by Route. It would entail adding another widget where you can manage routes (which are essentially order lists) as a new tab on top right of screen perhaps called the route management widget. Then each train really has a reference to a global route object. This way you can have lets say 10 trains for example all on the same route. And then if you want to make a change, all you have to do is change the route to change all the trains destinations. This is essentially the same as "Shared-Orders" in openTTD. I guess the reason I'm posting here is that route is a very useful thing to sort trains by. Routes could be auto-named by there start and end station or something along those lines (you could manually name them too).

@TrevorCash
Copy link
Copy Markdown

TrevorCash commented Jun 15, 2021

I also think that the trains list view should have a selection mechanic where you can select multiple trains and then on the bottom of the window you can do various actions to all the trains you have selected. For example: Set Route, Remove From Rail, Stop, etc.

@AaronVanGeffen
Copy link
Copy Markdown
Member Author

Hi @TrevorCash, thanks for your input! I agree, filtering by order table would be even better. Unfortunately, implementing shared orders requires more of the base game to be reimplemented in C++. I think we don't have an issue tracked for shared order tables yet, by the way -- feel free to create one!

(While it would technically be possible to share order tables at present, there is no good way to keep track of which ones are shared and such. Moreover, any of the original routines interopt
with might make assumptions about the data structures that would no longer hold.)

@TrevorCash
Copy link
Copy Markdown

I'll throw an issue up. Will be cool to see how things progress.

@AaronVanGeffen AaronVanGeffen linked an issue Jun 16, 2021 that may be closed by this pull request
@AaronVanGeffen AaronVanGeffen force-pushed the ui/vehicles-stopping-at branch from a2945c3 to 5531b88 Compare June 24, 2021 18:09
@AaronVanGeffen AaronVanGeffen added the changelog Requires a changelog entry label Jun 24, 2021
@AaronVanGeffen AaronVanGeffen marked this pull request as ready for review June 24, 2021 21:43
Comment on lines +2267 to +2268
2212: "{MOVE_X 10}Carrying {STRINGID} {SPRITE}"
2213: "»{MOVE_X 10}Carrying {STRINGID} {SPRITE}"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too sure about the wording here. I thought 'Transporting' was too long, but perhaps just 'Load of' would be better.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess technically trains could have less than 1 Load of a cargo. Maybe "Contains cargo"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, "Contains cargo" is even longer. To be honest, I think we should probably just drop the verb entirely.

Copy link
Copy Markdown
Contributor

@duncanspumpkin duncanspumpkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks sensible. Didn't test it though.

@AaronVanGeffen AaronVanGeffen force-pushed the ui/vehicles-stopping-at branch from df0447a to 9e14c4f Compare June 26, 2021 09:07
@AaronVanGeffen AaronVanGeffen merged commit 6a10da1 into OpenLoco:master Jun 26, 2021
@AaronVanGeffen AaronVanGeffen deleted the ui/vehicles-stopping-at branch June 26, 2021 09:12
@AaronVanGeffen AaronVanGeffen added this to the v21.05+ milestone Jun 26, 2021
tomasharkema added a commit to tomasharkema/OpenLoco that referenced this pull request Jul 13, 2021
…ature/mac-docker

* 'master' of https://github.com/OpenLoco/OpenLoco: (536 commits)
  Mention code style in readme (OpenLoco#1047)
  Remove redundant rotate function (OpenLoco#1046)
  Link up implemented function (OpenLoco#1043)
  Fix use of constants for coord limits (OpenLoco#1037)
  validCoords: remove template parameter and name type (OpenLoco#1033)
  Add coordinate validation to tile loops with offsets (OpenLoco#1031)
  Implement ChangeCompanyColour game command (OpenLoco#1029)
  Implement colour picker dropdowns (OpenLoco#1028)
  Implement StationManager::generateNewStationName (OpenLoco#1020)
  Station rename command (OpenLoco#984)
  Fix access to embedded object name (OpenLoco#1022)
  Reduce inclusion of StringIds.h in header files (OpenLoco#985)
  Implement the station name background paint (OpenLoco#1023)
  Force alignment on TileManager::createAnimation hook
  Merge duplicated flags and use accessors (OpenLoco#1025)
  Remove use of global stringformatbuffer where not required (OpenLoco#1024)
  Refactor calls to tryCreateInitialMovementSound (OpenLoco#1018)
  Turn widget draw functions into Widget struct member functions (OpenLoco#1012)
  Allow filtering the vehicle list by station or cargo (OpenLoco#997)
  Restore game command table alignment
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Requires a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow filtering the vehicle list window

3 participants