|
@@ -1269,49 +1269,49 @@ const Livery *GetEngineLivery(EngineID e
|
|
|
LiveryScheme scheme = LS_DEFAULT;
|
|
|
CargoID cargo_type = v == NULL ? (CargoID)CT_INVALID : v->cargo_type;
|
|
|
|
|
|
/* The default livery is always available for use, but its in_use flag determines
|
|
|
* whether any _other_ liveries are in use. */
|
|
|
if (c->livery[LS_DEFAULT].in_use && (_settings_client.gui.liveries == 2 || (_settings_client.gui.liveries == 1 && company == _local_company))) {
|
|
|
/* Determine the livery scheme to use */
|
|
|
const Engine *e = Engine::Get(engine_type);
|
|
|
switch (e->type) {
|
|
|
default: NOT_REACHED();
|
|
|
case VEH_TRAIN: {
|
|
|
const RailVehicleInfo *rvi = RailVehInfo(engine_type);
|
|
|
if (v != NULL && parent_engine_type != INVALID_ENGINE && (UsesWagonOverride(v) || (Train::From(v)->IsArticulatedPart() && rvi->railveh_type != RAILVEH_WAGON))) {
|
|
|
/* Wagonoverrides use the coloir scheme of the front engine.
|
|
|
* Articulated parts use the colour scheme of the first part. (Not supported for articulated wagons) */
|
|
|
engine_type = parent_engine_type;
|
|
|
e = Engine::Get(engine_type);
|
|
|
rvi = RailVehInfo(engine_type);
|
|
|
/* Note: Luckily cargo_type is not needed for engines */
|
|
|
}
|
|
|
|
|
|
if (cargo_type == CT_INVALID) cargo_type = e->GetDefaultCargoType();
|
|
|
if (cargo_type == CT_INVALID) cargo_type = CT_GOODS; // The vehicle does not carry anything, let's pick some freight cargo
|
|
|
if (rvi->railveh_type == RAILVEH_WAGON) {
|
|
|
if (!GetCargo(cargo_type)->is_freight) {
|
|
|
if (!CargoSpec::Get(cargo_type)->is_freight) {
|
|
|
if (parent_engine_type == INVALID_ENGINE) {
|
|
|
scheme = LS_PASSENGER_WAGON_STEAM;
|
|
|
} else {
|
|
|
switch (RailVehInfo(parent_engine_type)->engclass) {
|
|
|
default: NOT_REACHED();
|
|
|
case EC_STEAM: scheme = LS_PASSENGER_WAGON_STEAM; break;
|
|
|
case EC_DIESEL: scheme = LS_PASSENGER_WAGON_DIESEL; break;
|
|
|
case EC_ELECTRIC: scheme = LS_PASSENGER_WAGON_ELECTRIC; break;
|
|
|
case EC_MONORAIL: scheme = LS_PASSENGER_WAGON_MONORAIL; break;
|
|
|
case EC_MAGLEV: scheme = LS_PASSENGER_WAGON_MAGLEV; break;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
scheme = LS_FREIGHT_WAGON;
|
|
|
}
|
|
|
} else {
|
|
|
bool is_mu = HasBit(EngInfo(engine_type)->misc_flags, EF_RAIL_IS_MU);
|
|
|
|
|
|
switch (rvi->engclass) {
|
|
|
default: NOT_REACHED();
|
|
|
case EC_STEAM: scheme = LS_STEAM; break;
|
|
|
case EC_DIESEL: scheme = is_mu ? LS_DMU : LS_DIESEL; break;
|
|
|
case EC_ELECTRIC: scheme = is_mu ? LS_EMU : LS_ELECTRIC; break;
|
|
|
case EC_MONORAIL: scheme = LS_MONORAIL; break;
|