|
@@ -490,13 +490,13 @@ static uint32 VehicleGetVariable(const R
|
|
|
case 0x43: return _current_company | (LiveryHelper(object->u.vehicle.self_type, NULL) << 24); // Owner information
|
|
|
case 0x46: return 0; // Motion counter
|
|
|
case 0x47: { // Vehicle cargo info
|
|
|
const Engine *e = Engine::Get(object->u.vehicle.self_type);
|
|
|
CargoID cargo_type = e->GetDefaultCargoType();
|
|
|
if (cargo_type != CT_INVALID) {
|
|
|
const CargoSpec *cs = GetCargo(cargo_type);
|
|
|
const CargoSpec *cs = CargoSpec::Get(cargo_type);
|
|
|
return (cs->classes << 16) | (cs->weight << 8) | GetEngineGRF(e->index)->cargo_map[cargo_type];
|
|
|
} else {
|
|
|
return 0x000000FF;
|
|
|
}
|
|
|
}
|
|
|
case 0x48: return Engine::Get(object->u.vehicle.self_type)->flags; // Vehicle Type Info
|
|
@@ -546,13 +546,13 @@ static uint32 VehicleGetVariable(const R
|
|
|
for (u = v; u != NULL; u = u->Next()) {
|
|
|
if (v->type == VEH_TRAIN) user_def_data |= Train::From(u)->tcache.user_def_data;
|
|
|
|
|
|
/* Skip empty engines */
|
|
|
if (u->cargo_cap == 0) continue;
|
|
|
|
|
|
cargo_classes |= GetCargo(u->cargo_type)->classes;
|
|
|
cargo_classes |= CargoSpec::Get(u->cargo_type)->classes;
|
|
|
common_cargos[u->cargo_type]++;
|
|
|
}
|
|
|
|
|
|
/* Pick the most common cargo type */
|
|
|
uint common_cargo_best_amount = 0;
|
|
|
for (CargoID cargo = 0; cargo < NUM_CARGO; cargo++) {
|
|
@@ -576,13 +576,13 @@ static uint32 VehicleGetVariable(const R
|
|
|
if (common_subtypes[i] > common_subtype_best_amount) {
|
|
|
common_subtype_best_amount = common_subtypes[i];
|
|
|
common_subtype = i;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
uint8 common_bitnum = (common_cargo_type == CT_INVALID ? 0xFF : GetCargo(common_cargo_type)->bitnum);
|
|
|
uint8 common_bitnum = (common_cargo_type == CT_INVALID ? 0xFF : CargoSpec::Get(common_cargo_type)->bitnum);
|
|
|
v->vcache.cached_var42 = cargo_classes | (common_bitnum << 8) | (common_subtype << 16) | (user_def_data << 24);
|
|
|
SetBit(v->vcache.cache_valid, 2);
|
|
|
}
|
|
|
return v->vcache.cached_var42;
|
|
|
|
|
|
case 0x43: // Company information
|
|
@@ -649,13 +649,13 @@ static uint32 VehicleGetVariable(const R
|
|
|
/* Format: ccccwwtt
|
|
|
* tt - the cargo type transported by the vehicle,
|
|
|
* translated if a translation table has been installed.
|
|
|
* ww - cargo unit weight in 1/16 tons, same as cargo prop. 0F.
|
|
|
* cccc - the cargo class value of the cargo transported by the vehicle.
|
|
|
*/
|
|
|
const CargoSpec *cs = GetCargo(v->cargo_type);
|
|
|
const CargoSpec *cs = CargoSpec::Get(v->cargo_type);
|
|
|
|
|
|
return (cs->classes << 16) | (cs->weight << 8) | GetEngineGRF(v->engine_type)->cargo_map[v->cargo_type];
|
|
|
}
|
|
|
|
|
|
case 0x48: return Engine::Get(v->engine_type)->flags; // Vehicle Type Info
|
|
|
case 0x49: return v->build_year;
|