Skip to content

Commit

Permalink
Change: Treat extended waypoint classes as 'WAYP' class.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PeterN committed May 3, 2024
1 parent 9a7c30a commit b1fbc40
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/newgrf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1944,8 +1944,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;
}

Expand Down Expand Up @@ -4789,8 +4790,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);
break;
}

Expand Down

0 comments on commit b1fbc40

Please sign in to comment.