1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 18:39:10 +00:00

(svn r21090) -Codechange: Rename VehicleCache to NewGRFCache.

This commit is contained in:
terkhen
2010-11-06 12:37:55 +00:00
parent 98744c5ff0
commit 8eb3d653da
3 changed files with 30 additions and 29 deletions

View File

@@ -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->vcache.cache_valid, 0)) {
v->vcache.cached_var40 = PositionHelper(v, false);
SetBit(v->vcache.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->vcache.cache_valid, 1)) {
v->vcache.cached_var41 = PositionHelper(v, true);
SetBit(v->vcache.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->vcache.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->vcache.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->vcache.cache_valid, 3)) {
v->vcache.cached_var43 = v->owner | (Company::IsHumanID(v->owner) ? 0 : 0x10000) | (LiveryHelper(v->engine_type, v) << 24);
SetBit(v->vcache.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;