mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
Merge branch 'template_train_replacement' into template_train_replacement-sx
This commit is contained in:
commit
84e467328f
@ -623,6 +623,7 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object,
|
|||||||
|
|
||||||
case 0x4A: {
|
case 0x4A: {
|
||||||
if (v->type != VEH_TRAIN) return 0;
|
if (v->type != VEH_TRAIN) return 0;
|
||||||
|
if (Train::From(v)->IsVirtual()) return 0x1FF;
|
||||||
RailType rt = GetTileRailType(v->tile);
|
RailType rt = GetTileRailType(v->tile);
|
||||||
return (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) | GetReverseRailTypeTranslation(rt, object->ro.grffile);
|
return (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) | GetReverseRailTypeTranslation(rt, object->ro.grffile);
|
||||||
}
|
}
|
||||||
@ -716,9 +717,14 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object,
|
|||||||
const Train *t = Train::From(v);
|
const Train *t = Train::From(v);
|
||||||
bool is_powered_wagon = HasBit(t->flags, VRF_POWEREDWAGON);
|
bool is_powered_wagon = HasBit(t->flags, VRF_POWEREDWAGON);
|
||||||
const Train *u = is_powered_wagon ? t->First() : t; // for powered wagons the engine defines the type of engine (i.e. railtype)
|
const Train *u = is_powered_wagon ? t->First() : t; // for powered wagons the engine defines the type of engine (i.e. railtype)
|
||||||
RailType railtype = GetRailType(v->tile);
|
|
||||||
bool powered = t->IsEngine() || is_powered_wagon;
|
bool powered = t->IsEngine() || is_powered_wagon;
|
||||||
bool has_power = HasPowerOnRail(u->railtype, railtype);
|
bool has_power;
|
||||||
|
if (u->IsVirtual()) {
|
||||||
|
has_power = true;
|
||||||
|
} else {
|
||||||
|
RailType railtype = GetRailType(v->tile);
|
||||||
|
has_power = HasPowerOnRail(u->railtype, railtype);
|
||||||
|
}
|
||||||
|
|
||||||
if (powered && has_power) SetBit(modflags, 5);
|
if (powered && has_power) SetBit(modflags, 5);
|
||||||
if (powered && !has_power) SetBit(modflags, 6);
|
if (powered && !has_power) SetBit(modflags, 6);
|
||||||
|
Loading…
Reference in New Issue
Block a user