Fix refit in station with articulated vehicles with no capacity in leading part

This commit is contained in:
Jonathan G Rennison
2023-06-18 11:08:35 +01:00
parent dadebfa759
commit 846737e56a
3 changed files with 15 additions and 1 deletions

View File

@@ -305,6 +305,19 @@ bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *car
return false;
}
/**
* Returns the overall cargo of an articulated vehicle if all parts are refitted to the same cargo.
* Note: Vehicles not carrying anything are ignored
* @param v the first vehicle in the chain
* @return the common CargoID. (CT_INVALID if no part is carrying something or they are carrying different things)
*/
CargoID GetOverallCargoOfArticulatedVehicle(const Vehicle *v)
{
CargoID cargo_id;
IsArticulatedVehicleCarryingDifferentCargoes(v, &cargo_id);
return cargo_id;
}
/**
* Checks whether the specs of freshly build articulated vehicles are consistent with the information specified in the purchase list.
* Only essential information is checked to leave room for magic tricks/workarounds to grfcoders.