From e4613fc04c0c7aca665d7d4f7cf73e7aa03d5e06 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 4 Sep 2023 08:12:51 +0100 Subject: [PATCH] Codechange: Allow using more than 65536 NewGRF string IDs. NewGRF string allocation allowed up to 524288 strings, however stringid was passed as uint16_t which limits to 2^16. --- src/newgrf_text.cpp | 2 +- src/newgrf_text.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 1544eb4695..506e80a965 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -636,7 +636,7 @@ const char *GetGRFStringFromGRFText(const GRFTextWrapper &text) /** * Get a C-string from a stringid set by a newgrf. */ -const char *GetGRFStringPtr(uint16_t stringid) +const char *GetGRFStringPtr(uint32_t stringid) { assert(stringid < _grf_text.size()); assert(_grf_text[stringid].grfid != 0); diff --git a/src/newgrf_text.h b/src/newgrf_text.h index 21273e3d5e..c3dfa08cee 100644 --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -33,7 +33,7 @@ StringID AddGRFString(uint32_t grfid, uint16_t stringid, byte langid, bool new_s StringID GetGRFStringID(uint32_t grfid, StringID stringid); const char *GetGRFStringFromGRFText(const GRFTextList &text_list); const char *GetGRFStringFromGRFText(const GRFTextWrapper &text); -const char *GetGRFStringPtr(uint16_t stringid); +const char *GetGRFStringPtr(uint32_t stringid); void CleanUpStrings(); void SetCurrentGrfLangID(byte language_id); std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool allow_newlines, const std::string &str, StringControlCode byte80 = SCC_NEWGRF_PRINT_WORD_STRING_ID);