A small patch that allows users to restrict the lines shown in a depot's drop-down line list, to those that have a stop within a certain distance of the depot (currently hard-coded at 42). Useful e.g for urban networks.
nearby-lines.gif
The answer to life, the universe, and everything? :)
Quote from: Isaac Eiland-Hall on December 22, 2025, 01:36:14 AMThe answer to life, the universe, and everything? :)
Also an empirical constant that is neither too large (showing lines too far away) nor too small (not showing some nearby lines).
This is exactly the thing I wanted for some time.
This is dictating the players a certain style. I play deliberately with a single depot per network. Since Simutrans cannot guess the player's style, the general rules was to not commit anything forcing a certain style.
Thus, the patch has little chance of incorporation without making it configurable via the GUI and off by default.
It would be different if limiting to stops connected to this depot. But finding this out is very time consuming and non-trivial. And convois with their home depot would not apply for new depots.
Here is a variant which makes the distance configurable on a per-depot basis. (It is not saved with the map though.) Note that it was already disabled by default.
nearby-lines-conf.png
What about this idea: instead of a button to find near lines, there's a 'filter' button that opens a drop down menu with different options that help us find the desired line: near lines in given distance, lines carrying people/post/cargo, search by name, stuff like that.
Filter by goods/pax/etc. is already in the dialog. It would be easy to filter the lines for this.
In r11879 any combobox can be searched for match text. The downside is that editing cannto reposition the cursor with the mouse. Please comment on this change. I will revert it if it is not good.
Good idea but the droplist is updated after the first character is typed but not after any others, and it would be nice if the search functionality ignored case. Patch 1 implements this.
It seems weird to me to be able to search in comboboxes that only display a few fixed items (such as the line management window's "Name"/"Vehicle earnings"/"Operational profit"/... sort mode one) so patch 2 makes searchability optional. This also avoids the combobox's contents disappearing when the drop-down is open (unless the combobox is searchable).
I am not sure, two differently behaving combobox will not be confusing.
Thanks for spotting the error. I made it so that the current selection is hsown until something has been typed for a search (and then shown in another color). So you have the old behaviour with the new functionality added.