summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes E. Krause <j.k@eclipso.de>2019-01-15 19:52:00 +0100
committerfrosch <github@elsenhans.name>2021-01-10 21:24:38 +0100
commitf1bc4d8407613795c1b0c1fbe3b1adf39479913d (patch)
tree33de884efe6a64b8374b7c331f51dcb8608f6afb
parent868d84bbfc8d2c1471ef713854dd05ebc872615a (diff)
downloadopenttd-f1bc4d8407613795c1b0c1fbe3b1adf39479913d.tar.xz
Add: [NewGRF] Vehicle variable 4A now also returns, whether the current tile has catenary.
-rw-r--r--src/newgrf_engine.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index e3dc059ff..d67a5c118 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -609,12 +609,18 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object,
switch (v->type) {
case VEH_TRAIN: {
RailType rt = GetTileRailType(v->tile);
- return (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) | GetReverseRailTypeTranslation(rt, object->ro.grffile);
+ const RailtypeInfo *rti = GetRailTypeInfo(rt);
+ return ((rti->flags & RTFB_CATENARY) ? 0x200 : 0) |
+ (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) |
+ GetReverseRailTypeTranslation(rt, object->ro.grffile);
}
case VEH_ROAD: {
RoadType rt = GetRoadType(v->tile, GetRoadTramType(RoadVehicle::From(v)->roadtype));
- return 0x100 | GetReverseRoadTypeTranslation(rt, object->ro.grffile);
+ const RoadTypeInfo *rti = GetRoadTypeInfo(rt);
+ return ((rti->flags & ROTFB_CATENARY) ? 0x200 : 0) |
+ 0x100 |
+ GetReverseRoadTypeTranslation(rt, object->ro.grffile);
}
default: