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

@@ -3508,6 +3508,7 @@ bool Order::CanLeaveWithCargo(bool has_cargo, CargoID cargo) const
* - p1 = (bit 0 - 15) - The destination ID to change from
* - p1 = (bit 16 - 18) - The vehicle type
* - p1 = (bit 20 - 23) - The order type
* - p1 = (bit 24 - 31) - Cargo filter
* @param p2 various bitstuffed elements
* - p2 = (bit 0 - 15) - The destination ID to change to
* @param text unused
@@ -3518,11 +3519,12 @@ CommandCost CmdMassChangeOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, u
DestinationID from_dest = GB(p1, 0, 16);
VehicleType vehtype = Extract<VehicleType, 16, 3>(p1);
OrderType order_type = (OrderType) GB(p1, 20, 4);
CargoID cargo_filter = GB(p1, 24, 8);
DestinationID to_dest = GB(p2, 0, 16);
if (flags & DC_EXEC) {
for (Vehicle *v : Vehicle::Iterate()) {
if (v->type == vehtype && v->IsPrimaryVehicle() && CheckOwnership(v->owner).Succeeded()) {
if (v->type == vehtype && v->IsPrimaryVehicle() && CheckOwnership(v->owner).Succeeded() && VehicleCargoFilter(v, cargo_filter)) {
int index = 0;
bool changed = false;