From 7490284518ebaec29241c5053939f6466d3a9d1b Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 3 May 2024 15:59:18 +0100 Subject: [PATCH] Change: Treat extended waypoint classes as 'WAYP' class. This maps the extended custom waypoint clases (where the first byte of the label is 0xFF) to the standard 'WAYP' label, allowing use of them before the feature exists. --- src/newgrf.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 0bca10e793..82d2c9795e 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1937,8 +1937,9 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte } /* Swap classid because we read it in BE meaning WAYP or DFLT */ - uint32_t classid = buf->ReadDWord(); - statspec->cls_id = StationClass::Allocate(BSWAP32(classid)); + uint32_t classid = BSWAP32(buf->ReadDWord()); + if (GB(classid, 24, 8) == 0xFF) classid = 'WAYP'; + statspec->cls_id = StationClass::Allocate(classid); break; } @@ -4838,8 +4839,9 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, ByteR rs = _cur.grffile->roadstops[id + i].get(); } - uint32_t classid = buf->ReadDWord(); - rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid)); + uint32_t classid = BSWAP32(buf->ReadDWord()); + if (GB(classid, 24, 8) == 0xFF) classid = 'WAYP'; + rs->cls_id = RoadStopClass::Allocate(classid); rs->spec_id = id + i; break; }