From 7f351fd7c1e853918d2ce7bfd1c9c6c5a2af84ef Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 18 Dec 2019 00:48:03 +0100 Subject: [PATCH] Fix: Action7/9 conditions 0F..12 reported roadtypes as valid tramtypes and vice versa. --- src/newgrf.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 19086e3768..f4197c9aa9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -6622,15 +6622,26 @@ static void SkipIf(ByteReader *buf) break; case 0x0E: result = GetRailTypeByLabel(BSWAP32(cond_val)) != INVALID_RAILTYPE; break; - case 0x0F: result = GetRoadTypeByLabel(BSWAP32(cond_val)) == INVALID_ROADTYPE; + case 0x0F: { + RoadType rt = GetRoadTypeByLabel(BSWAP32(cond_val)); + result = rt == INVALID_ROADTYPE || !RoadTypeIsRoad(rt); break; - case 0x10: result = GetRoadTypeByLabel(BSWAP32(cond_val)) != INVALID_ROADTYPE; + } + case 0x10: { + RoadType rt = GetRoadTypeByLabel(BSWAP32(cond_val)); + result = rt != INVALID_ROADTYPE && RoadTypeIsRoad(rt); break; - case 0x11: result = GetRoadTypeByLabel(BSWAP32(cond_val)) == INVALID_ROADTYPE; + } + case 0x11: { + RoadType rt = GetRoadTypeByLabel(BSWAP32(cond_val)); + result = rt == INVALID_ROADTYPE || !RoadTypeIsTram(rt); break; - case 0x12: result = GetRoadTypeByLabel(BSWAP32(cond_val)) != INVALID_ROADTYPE; + } + case 0x12: { + RoadType rt = GetRoadTypeByLabel(BSWAP32(cond_val)); + result = rt != INVALID_ROADTYPE && RoadTypeIsTram(rt); break; - + } default: grfmsg(1, "SkipIf: Unsupported condition type %02X. Ignoring", condtype); return; } }