This is a request from translators as depot is not valid for all vehicle types in all translations
This will cause a lot of warnings when generating the lang files. MiHaMiX will fix them in a moment (hopefully)
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way
Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway
Made road vehicle depot windows start with one more row to make room for the buttons
This will prevent some reallocations when sorting vehicle list windows
It also prevents moving the whole array into a new one each time the list is generated/updated (it used to make the list in one array and then move it into another one each time)
Also ensured that neither GenerateVehicleSortList() or BuildDepotVehicleList() will never allocate lists longer than the total number of vehicles in the game
It made no sense to maintain 8 nearly identically arrays when a single one can do the job
Also made the two buttons always use half of the bottom width each, even when resizing
To do this, the player struct contains an array, that contains the count of each engine type that the player owns
Those arrays are updated each time a vehicle is build or deleted and is calculated on load (it's not saved)
It's possible to access the arrays outside of the autoreplace GUI, so feel free to read from them in other patches as well
-Codechange: Initialize sorting-type on WE_CREATE instead of checking every time.
-Codechange: Update custom vehiclelist_d with standard list_d struct, more static
-Codechange: unified the code for mass goto depot to avoid duplicated code
-Fix: Vehicles already on the way to depots will not be cancelled by mass goto depot (made it really hard to send all vehicles at once)
this list is also used by mass goto depot to ensure that they use the same vehicles
right now only the list of all vehicles use this for goto depot, but eventually all the types will use this
it's located in the vehicle list screen and does the same as in the shared orders window (send all vehicles in list to a depot)
it will still not inform the player if a vehicle failed to find a depot, so don't take for granted that all of them go
code to delete an empty shared orders list is now much simpler
cleaned up the code to handle button clicks
fixed an assert if widget 9 was pressed on a list with vehicles for another company
Since the order is no more, the player will not need that particular window anymore
this could happen if the player opened the window and then sold all the vehicles (or crashed them)
A crash could happen if a new order gets the same (now freed) OrderID and the vehicle using it is not of the same type as the window expect
this makes the list type detection much easier and allowed an if cascade to be turned into a switch case
this also makes it easier to add more list types
the list is available in the orders window and looks like the list buttons from the station windows (small vehicle)
The button is disabled if the vehicle do not have any shared orders or it got shared orders, but an empty order list
based on a patch by nycom, thought it ended up getting heavily modified
Thanks to TrueLight for proofreading and suggestions