#include "vehicle_type.h"
#include "engine_type.h"
Go to the source code of this file.
Functions | |
uint | CountArticulatedParts (EngineID engine_type, bool purchase_window) |
CargoArray | GetCapacityOfArticulatedParts (EngineID engine) |
void | AddArticulatedParts (Vehicle *first) |
void | GetArticulatedRefitMasks (EngineID engine, bool include_initial_cargo_type, uint32 *union_mask, uint32 *intersection_mask) |
Merges the refit_masks of all articulated parts. | |
uint32 | GetUnionOfArticulatedRefitMasks (EngineID engine, bool include_initial_cargo_type) |
Ors the refit_masks of all articulated parts. | |
uint32 | GetIntersectionOfArticulatedRefitMasks (EngineID engine, bool include_initial_cargo_type) |
Ands the refit_masks of all articulated parts. | |
bool | IsArticulatedVehicleCarryingDifferentCargos (const Vehicle *v, CargoID *cargo_type) |
Tests if all parts of an articulated vehicle are refitted to the same cargo. | |
bool | IsArticulatedVehicleRefittable (EngineID engine) |
Checks whether any of the articulated parts is refittable. | |
void | CheckConsistencyOfArticulatedVehicle (const Vehicle *v) |
Checks whether the specs of freshly build articulated vehicles are consistent with the information specified in the purchase list. |
Definition in file articulated_vehicles.h.
void CheckConsistencyOfArticulatedVehicle | ( | const Vehicle * | v | ) |
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. It checks: For autoreplace/-renew:
Definition at line 251 of file articulated_vehicles.cpp.
References SpecializedVehicle< RoadVehicle, VEH_ROAD >::From(), SpecializedVehicle< Train, VEH_TRAIN >::From(), GBUG_VEH_REFIT, GetArticulatedRefitMasks(), GetAvailableVehicleCargoTypes(), Train::GetNextArticPart(), RoadVehicle::HasArticulatedPart(), Train::HasArticulatedPart(), NUM_CARGO, ShowNewGrfVehicleError(), VEH_ROAD, and VEH_TRAIN.
Referenced by CmdBuildRailVehicle(), CmdBuildRailWagon(), and CmdBuildRoadVeh().
void GetArticulatedRefitMasks | ( | EngineID | engine, | |
bool | include_initial_cargo_type, | |||
uint32 * | union_mask, | |||
uint32 * | intersection_mask | |||
) |
Merges the refit_masks of all articulated parts.
engine | the first part | |
include_initial_cargo_type | if true the default cargo type of the vehicle is included; if false only the refit_mask | |
union_mask | returns bit mask of CargoIDs which are a refit option for at least one articulated part | |
intersection_mask | returns bit mask of CargoIDs which are a refit option for every articulated part (with default capacity > 0) |
Definition at line 157 of file articulated_vehicles.cpp.
References CBM_VEHICLE_ARTIC_ENGINE, GetAvailableVehicleCargoTypes(), GetNextArticPart(), HasBit(), VEH_ROAD, and VEH_TRAIN.
Referenced by CheckConsistencyOfArticulatedVehicle(), GetIntersectionOfArticulatedRefitMasks(), GetNewCargoTypeForReplace(), and GetUnionOfArticulatedRefitMasks().
uint32 GetIntersectionOfArticulatedRefitMasks | ( | EngineID | engine, | |
bool | include_initial_cargo_type | |||
) |
Ands the refit_masks of all articulated parts.
engine | the first part | |
include_initial_cargo_type | if true the default cargo type of the vehicle is included; if false only the refit_mask |
Definition at line 196 of file articulated_vehicles.cpp.
References GetArticulatedRefitMasks().
uint32 GetUnionOfArticulatedRefitMasks | ( | EngineID | engine, | |
bool | include_initial_cargo_type | |||
) |
Ors the refit_masks of all articulated parts.
engine | the first part | |
include_initial_cargo_type | if true the default cargo type of the vehicle is included; if false only the refit_mask |
Definition at line 183 of file articulated_vehicles.cpp.
References GetArticulatedRefitMasks().
Referenced by AIEngine::CanRefitCargo(), CargoFilter(), EnginesHaveCargoInCommon(), ShowRefitOptionsList(), and VerifyAutoreplaceRefitForOrders().
bool IsArticulatedVehicleCarryingDifferentCargos | ( | const Vehicle * | v, | |
CargoID * | cargo_type | |||
) |
Tests if all parts of an articulated vehicle are refitted to the same cargo.
Note: Vehicles not carrying anything are ignored
v | the first vehicle in the chain | |
cargo_type | returns the common CargoID if needed. (CT_INVALID if no part is carrying something or they are carrying different things) |
Definition at line 211 of file articulated_vehicles.cpp.
References CT_INVALID, SpecializedVehicle< RoadVehicle, VEH_ROAD >::From(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Train::GetNextArticPart(), RoadVehicle::HasArticulatedPart(), Train::HasArticulatedPart(), VEH_ROAD, and VEH_TRAIN.
Referenced by GetNewCargoTypeForReplace().
bool IsArticulatedVehicleRefittable | ( | EngineID | engine | ) |
Checks whether any of the articulated parts is refittable.
engine | the first part |
Definition at line 131 of file articulated_vehicles.cpp.
References CBM_VEHICLE_ARTIC_ENGINE, GetNextArticPart(), HasBit(), IsEngineRefittable(), VEH_ROAD, and VEH_TRAIN.
Referenced by DrawVehiclePurchaseInfo().