(svn r16390) -Codechange: move u.road to RoadVehicle.

This commit is contained in:
rubidium
2009-05-22 20:22:20 +00:00
parent d37b840cf3
commit 7a37220881
22 changed files with 308 additions and 287 deletions

View File

@@ -5,6 +5,7 @@
#include "stdafx.h"
#include "debug.h"
#include "train.h"
#include "roadveh.h"
#include "company_func.h"
#include "newgrf_engine.h"
#include "newgrf_spritegroup.h"
@@ -435,7 +436,7 @@ static uint8 LiveryHelper(EngineID engine, const Vehicle *v)
} else if (v->type == VEH_TRAIN) {
l = GetEngineLivery(v->engine_type, v->owner, v->u.rail.first_engine, v);
} else if (v->type == VEH_ROAD) {
l = GetEngineLivery(v->engine_type, v->owner, v->u.road.first_engine, v);
l = GetEngineLivery(v->engine_type, v->owner, ((RoadVehicle *)v)->first_engine, v);
} else {
l = GetEngineLivery(v->engine_type, v->owner, INVALID_ENGINE, v);
}
@@ -780,17 +781,18 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
}
break;
case VEH_ROAD:
case VEH_ROAD: {
RoadVehicle *rv = (RoadVehicle *)v;
switch (variable - 0x80) {
case 0x62: return v->u.road.state;
case 0x64: return v->u.road.blocked_ctr;
case 0x65: return GB(v->u.road.blocked_ctr, 8, 8);
case 0x66: return v->u.road.overtaking;
case 0x67: return v->u.road.overtaking_ctr;
case 0x68: return v->u.road.crashed_ctr;
case 0x69: return GB(v->u.road.crashed_ctr, 8, 8);
case 0x62: return rv->state;
case 0x64: return rv->blocked_ctr;
case 0x65: return GB(rv->blocked_ctr, 8, 8);
case 0x66: return rv->overtaking;
case 0x67: return rv->overtaking_ctr;
case 0x68: return rv->crashed_ctr;
case 0x69: return GB(rv->crashed_ctr, 8, 8);
}
break;
} break;
case VEH_AIRCRAFT: {
Aircraft *a = (Aircraft *)v;
@@ -885,7 +887,7 @@ static const SpriteGroup *GetVehicleSpriteGroup(EngineID engine, const Vehicle *
group = use_cache ? v->u.rail.cached_override : GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, v->u.rail.first_engine);
if (group != NULL) return group;
} else if (v->type == VEH_ROAD) {
group = GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, v->u.road.first_engine);
group = GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, ((RoadVehicle *)v)->first_engine);
if (group != NULL) return group;
}
}