From 5bcc71f2c2903facbacb7ead525f06f4081887f7 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 6 Aug 2023 01:21:19 +0100 Subject: [PATCH] Fix incorrect industry NewGRF text ID mapping In the case where the lower 16 bits of the internal string ID was also a valid NewGRF string ID --- src/newgrf_text.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 30f9bcf444..24c3ad591b 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -615,6 +615,8 @@ StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool ne */ StringID GetGRFStringID(uint32 grfid, StringID stringid) { + if (stringid > UINT16_MAX) return STR_UNDEFINED; + extern GRFFile *GetFileByGRFIDExpectCurrent(uint32 grfid); GRFFile *grf = GetFileByGRFIDExpectCurrent(grfid); if (unlikely(grf == nullptr)) {