@ -512,21 +512,21 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
return GetEngineGRFID ( v - > engine_type ) ;
case 0x40 : // Get length of consist
if ( ! HasBit ( v - > v cache. cache_valid , 0 ) ) {
v - > vcache. cached_var40 = PositionHelper ( v , false ) ;
SetBit ( v - > v cache. cache_valid , 0 ) ;
if ( ! HasBit ( v - > grf_ cache. cache_valid , 0 ) ) {
v - > grf_cache. position_consist_length = PositionHelper ( v , false ) ;
SetBit ( v - > grf_ cache. cache_valid , 0 ) ;
}
return v - > vcache. cached_var40 ;
return v - > grf_cache. position_consist_length ;
case 0x41 : // Get length of same consecutive wagons
if ( ! HasBit ( v - > v cache. cache_valid , 1 ) ) {
v - > vcache. cached_var41 = PositionHelper ( v , true ) ;
SetBit ( v - > v cache. cache_valid , 1 ) ;
if ( ! HasBit ( v - > grf_ cache. cache_valid , 1 ) ) {
v - > grf_cache. position_same_id_length = PositionHelper ( v , true ) ;
SetBit ( v - > grf_ cache. cache_valid , 1 ) ;
}
return v - > vcache. cached_var41 ;
return v - > grf_cache. position_same_id_length ;
case 0x42 : // Consist cargo information
if ( ! HasBit ( v - > v cache. cache_valid , 2 ) ) {
if ( ! HasBit ( v - > grf_ cache. cache_valid , 2 ) ) {
const Vehicle * u ;
byte cargo_classes = 0 ;
uint8 common_cargos [ NUM_CARGO ] ;
@ -576,17 +576,17 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
}
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 - > v cache. cache_valid , 2 ) ;
v - > grf_cache. consist_cargo_information = cargo_classes | ( common_bitnum < < 8 ) | ( common_subtype < < 16 ) | ( user_def_data < < 24 ) ;
SetBit ( v - > grf_ cache. cache_valid , 2 ) ;
}
return v - > vcache. cached_var42 ;
return v - > grf_cache. consist_cargo_information ;
case 0x43 : // Company information
if ( ! HasBit ( v - > v cache. cache_valid , 3 ) ) {
v - > vcache. cached_var43 = v - > owner | ( Company : : IsHumanID ( v - > owner ) ? 0 : 0x10000 ) | ( LiveryHelper ( v - > engine_type , v ) < < 24 ) ;
SetBit ( v - > v cache. cache_valid , 3 ) ;
if ( ! HasBit ( v - > grf_ cache. cache_valid , 3 ) ) {
v - > grf_cache. company_information = v - > owner | ( Company : : IsHumanID ( v - > owner ) ? 0 : 0x10000 ) | ( LiveryHelper ( v - > engine_type , v ) < < 24 ) ;
SetBit ( v - > grf_ cache. cache_valid , 3 ) ;
}
return v - > vcache. cached_var43 ;
return v - > grf_cache. company_information ;
case 0x44 : // Aircraft information
if ( v - > type ! = VEH_AIRCRAFT ) return UINT_MAX ;