forked from mirror/OpenTTD
(svn r16392) -Codechange: move some variables (the ones that aren't caches) from VehicleRail to Train
This commit is contained in:
@@ -672,12 +672,12 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
||||
const Train *u = IsTrainWagon(v) && HasBit(v->vehicle_flags, VRF_POWEREDWAGON) ? t->First() : t;
|
||||
RailType railtype = GetRailType(v->tile);
|
||||
bool powered = IsTrainEngine(v) || (IsTrainWagon(v) && HasBit(v->vehicle_flags, VRF_POWEREDWAGON));
|
||||
bool has_power = powered && HasPowerOnRail(u->u.rail.railtype, railtype);
|
||||
bool is_electric = powered && u->u.rail.railtype == RAILTYPE_ELECTRIC;
|
||||
bool has_power = powered && HasPowerOnRail(u->railtype, railtype);
|
||||
bool is_electric = powered && u->railtype == RAILTYPE_ELECTRIC;
|
||||
|
||||
if (has_power) SetBit(modflags, 5);
|
||||
if (is_electric && !has_power) SetBit(modflags, 6);
|
||||
if (HasBit(t->u.rail.flags, VRF_TOGGLE_REVERSE)) SetBit(modflags, 8);
|
||||
if (HasBit(t->flags, VRF_TOGGLE_REVERSE)) SetBit(modflags, 8);
|
||||
}
|
||||
if (HasBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SetBit(modflags, 10);
|
||||
|
||||
@@ -736,7 +736,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
||||
case 0x47: return GB(Engine::Get(v->engine_type)->internal_id, 8, 8);
|
||||
case 0x48:
|
||||
if (v->type != VEH_TRAIN || v->spritenum != 0xFD) return v->spritenum;
|
||||
return HasBit(((Train *)v)->u.rail.flags, VRF_REVERSE_DIRECTION) ? 0xFE : 0xFD;
|
||||
return HasBit(((Train *)v)->flags, VRF_REVERSE_DIRECTION) ? 0xFE : 0xFD;
|
||||
|
||||
case 0x49: return v->day_counter;
|
||||
case 0x4A: return v->breakdowns_since_last_service;
|
||||
@@ -770,8 +770,8 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
||||
case VEH_TRAIN: {
|
||||
Train *t = (Train *)v;
|
||||
switch (variable - 0x80) {
|
||||
case 0x62: return t->u.rail.track;
|
||||
case 0x66: return t->u.rail.railtype;
|
||||
case 0x62: return t->track;
|
||||
case 0x66: return t->railtype;
|
||||
case 0x73: return t->u.rail.cached_veh_length;
|
||||
case 0x74: return t->u.rail.cached_power;
|
||||
case 0x75: return GB(t->u.rail.cached_power, 8, 24);
|
||||
|
Reference in New Issue
Block a user