From fc4c4d080c5d95d92354cefac4a05082fc417c83 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 26 Feb 2017 19:41:14 +0000 Subject: [PATCH] (svn r27757) -Change: Make StringID 32bit. --- src/company_base.h | 4 ++-- src/saveload/company_sl.cpp | 2 +- src/saveload/saveload.h | 4 ++-- src/script/api/script_types.hpp | 2 +- src/strings_type.h | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/company_base.h b/src/company_base.h index 0017761216..4d76e6251a 100644 --- a/src/company_base.h +++ b/src/company_base.h @@ -52,10 +52,10 @@ extern CompanyPool _company_pool; /** Statically loadable part of Company pool item */ struct CompanyProperties { uint32 name_2; ///< Parameter of #name_1. - uint16 name_1; ///< Name of the company if the user did not change it. + StringID name_1; ///< Name of the company if the user did not change it. char *name; ///< Name of the company if the user changed it. - uint16 president_name_1; ///< Name of the president if the user did not change it. + StringID president_name_1; ///< Name of the president if the user did not change it. uint32 president_name_2; ///< Parameter of #president_name_1 char *president_name; ///< Name of the president if the user changed it. diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp index 2ad9759901..733bc0eaf9 100644 --- a/src/saveload/company_sl.cpp +++ b/src/saveload/company_sl.cpp @@ -244,7 +244,7 @@ static const SaveLoad _company_desc[] = { SLE_VAR(CompanyProperties, name_1, SLE_STRINGID), SLE_CONDSTR(CompanyProperties, name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION), - SLE_VAR(CompanyProperties, president_name_1, SLE_UINT16), + SLE_VAR(CompanyProperties, president_name_1, SLE_STRINGID), SLE_VAR(CompanyProperties, president_name_2, SLE_UINT32), SLE_CONDSTR(CompanyProperties, president_name, SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION), diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 1513355c8d..d492558c5a 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -49,7 +49,7 @@ enum SavegameType { extern FileToSaveLoad _file_to_saveload; void GenerateDefaultSaveName(char *buf, const char *last); -void SetSaveLoadError(uint16 str); +void SetSaveLoadError(StringID str); const char *GetSaveLoadErrorString(); SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded = true); void WaitTillSaved(); @@ -161,7 +161,7 @@ enum VarTypes { SLE_INT64 = SLE_FILE_I64 | SLE_VAR_I64, SLE_UINT64 = SLE_FILE_U64 | SLE_VAR_U64, SLE_CHAR = SLE_FILE_I8 | SLE_VAR_CHAR, - SLE_STRINGID = SLE_FILE_STRINGID | SLE_VAR_U16, + SLE_STRINGID = SLE_FILE_STRINGID | SLE_VAR_U32, SLE_STRINGBUF = SLE_FILE_STRING | SLE_VAR_STRB, SLE_STRINGBQUOTE = SLE_FILE_STRING | SLE_VAR_STRBQ, SLE_STRING = SLE_FILE_STRING | SLE_VAR_STR, diff --git a/src/script/api/script_types.hpp b/src/script/api/script_types.hpp index d3ac70b4d4..bd9b7c5607 100644 --- a/src/script/api/script_types.hpp +++ b/src/script/api/script_types.hpp @@ -98,7 +98,7 @@ typedef uint8 IndustryType; ///< The ID of an industry-type. typedef OverflowSafeInt64 Money; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds. typedef uint16 SignID; ///< The ID of a sign. typedef uint16 StationID; ///< The ID of a station. -typedef uint16 StringID; ///< The ID of a string. +typedef uint32 StringID; ///< The ID of a string. typedef uint16 SubsidyID; ///< The ID of a subsidy. typedef uint16 StoryPageID; ///< The ID of a story page. typedef uint16 StoryPageElementID; ///< The ID of a story page element. diff --git a/src/strings_type.h b/src/strings_type.h index 098d3f94db..f8144f79f2 100644 --- a/src/strings_type.h +++ b/src/strings_type.h @@ -15,8 +15,8 @@ /** * Numeric value that represents a string, independent of the selected language. */ -typedef uint16 StringID; -static const StringID INVALID_STRING_ID = 0xFFFF; ///< Constant representing an invalid string +typedef uint32 StringID; +static const StringID INVALID_STRING_ID = 0xFFFF; ///< Constant representing an invalid string (16bit in case it is used in savegames) static const int MAX_CHAR_LENGTH = 4; ///< Max. length of UTF-8 encoded unicode character static const uint MAX_LANG = 0x7F; ///< Maximum number of languages supported by the game, and the NewGRF specs