Vehicle list commands now take into account cargo type filter

Start/stop
Send to depot type commands
Add to new group
Change order target
This commit is contained in:
Jonathan G Rennison
2022-11-19 22:40:29 +00:00
parent 728b902e9f
commit 03a9912a2b
10 changed files with 88 additions and 75 deletions

View File

@@ -14,6 +14,7 @@
#include "vehicle_type.h"
#include "company_type.h"
#include "tile_type.h"
#include "cargo_type.h"
/** Vehicle List type flags */
enum VehicleListType {
@@ -51,10 +52,18 @@ struct VehicleListIdentifier {
VehicleListIdentifier() : type(), vtype(), company(), index() {}
};
/** Special cargo filter criteria */
enum VehicleCargoFilterSpecialType {
CF_ANY = CT_NO_REFIT, ///< Show all vehicles independent of carried cargo (i.e. no filtering)
CF_NONE = CT_INVALID, ///< Show only vehicles which do not carry cargo (e.g. train engines)
CF_FREIGHT = CT_AUTO_REFIT, ///< Show only vehicles which carry any freight (non-passenger) cargo
};
/** A list of vehicles. */
typedef std::vector<const Vehicle *> VehicleList;
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier);
bool VehicleCargoFilter(const Vehicle *v, const CargoID cid);
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier, const CargoID cid = CF_ANY);
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
uint GetUnitNumberDigits(VehicleList &vehicles);