OpenTTD Source 20241224-master-gf74b0cf984
strings_type.h File Reference

Types related to strings. More...

Go to the source code of this file.

Typedefs

typedef uint32_t StringID
 Numeric value that represents a string, independent of the selected language.
 
using StringParameterData = std::variant< uint64_t, std::string >
 

Enumerations

enum  TextDirection { TD_LTR , TD_RTL }
 Directions a text can go to. More...
 
enum  StringTab {
  TEXT_TAB_TOWN = 4 , TEXT_TAB_INDUSTRY = 9 , TEXT_TAB_STATION = 12 , TEXT_TAB_SPECIAL = 14 ,
  TEXT_TAB_OLD_CUSTOM = 15 , TEXT_TAB_VEHICLE = 16 , TEXT_TAB_OLD_NEWGRF = 26 , TEXT_TAB_END = 32 ,
  TEXT_TAB_GAMESCRIPT_START = 32 , TEXT_TAB_NEWGRF_START = 64
}
 StringTabs to group StringIDs. More...
 
enum  SpecialStrings {
  SPECSTR_TOWNNAME_START = 0x20C0 , SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START , SPECSTR_TOWNNAME_FRENCH , SPECSTR_TOWNNAME_GERMAN ,
  SPECSTR_TOWNNAME_AMERICAN , SPECSTR_TOWNNAME_LATIN , SPECSTR_TOWNNAME_SILLY , SPECSTR_TOWNNAME_SWEDISH ,
  SPECSTR_TOWNNAME_DUTCH , SPECSTR_TOWNNAME_FINNISH , SPECSTR_TOWNNAME_POLISH , SPECSTR_TOWNNAME_SLOVAK ,
  SPECSTR_TOWNNAME_NORWEGIAN , SPECSTR_TOWNNAME_HUNGARIAN , SPECSTR_TOWNNAME_AUSTRIAN , SPECSTR_TOWNNAME_ROMANIAN ,
  SPECSTR_TOWNNAME_CZECH , SPECSTR_TOWNNAME_SWISS , SPECSTR_TOWNNAME_DANISH , SPECSTR_TOWNNAME_TURKISH ,
  SPECSTR_TOWNNAME_ITALIAN , SPECSTR_TOWNNAME_CATALAN , SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_CATALAN , SPECSTR_COMPANY_NAME_START = 0x70EA ,
  SPECSTR_COMPANY_NAME_LAST = SPECSTR_COMPANY_NAME_START + SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START , SPECSTR_SILLY_NAME = 0x70E5 , SPECSTR_ANDCO_NAME = 0x70E6 , SPECSTR_PRESIDENT_NAME = 0x70E7
}
 Special string constants. More...
 

Variables

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.
 
static const uint TAB_SIZE_BITS = 11
 Number of bits for the StringIndex within a StringTab.
 
static const uint TAB_SIZE = 1 << TAB_SIZE_BITS
 Number of strings per StringTab.
 
static const uint TAB_SIZE_GAMESCRIPT = TAB_SIZE * 32
 Number of strings for GameScripts.
 
static const uint TAB_SIZE_NEWGRF = TAB_SIZE * 256
 Number of strings for NewGRFs.
 

Detailed Description

Types related to strings.

Definition in file strings_type.h.

Typedef Documentation

◆ StringID

typedef uint32_t StringID

Numeric value that represents a string, independent of the selected language.

Definition at line 16 of file strings_type.h.

◆ StringParameterData

using StringParameterData = std::variant<uint64_t, std::string>

Definition at line 91 of file strings_type.h.

Enumeration Type Documentation

◆ SpecialStrings

Special string constants.

Definition at line 55 of file strings_type.h.

◆ StringTab

enum StringTab

StringTabs to group StringIDs.

Enumerator
TEXT_TAB_END 

End of language files.

TEXT_TAB_GAMESCRIPT_START 

Start of GameScript supplied strings.

TEXT_TAB_NEWGRF_START 

Start of NewGRF supplied strings.

Definition at line 28 of file strings_type.h.

◆ TextDirection

Directions a text can go to.

Enumerator
TD_LTR 

Text is written left-to-right by default.

TD_RTL 

Text is written right-to-left by default.

Definition at line 22 of file strings_type.h.

Variable Documentation

◆ INVALID_STRING_ID

const StringID INVALID_STRING_ID = 0xFFFF
static

Constant representing an invalid string (16bit in case it is used in savegames)

Definition at line 17 of file strings_type.h.

Referenced by NewGRFWindow::AddGRFToActive(), ClientNetworkContentSocketHandler::AfterDownload(), AfterLoadGame(), GameOptionsWindow::BuildDropDownList(), PickerWindow::BuildPickerClassList(), PickerWindow::BuildPickerTypeList(), CheckDynamicEngines(), CheckForMissingGlyphs(), CheckOrders(), CheckTrainsLengths(), LoadCheckData::Clear(), ClickChangeMaxHlCheat(), NetworkGameSocketHandler::CloseConnection(), CmdLevelLand(), CmdPlantTree(), CmdSignalTrackHelper(), DeleteVehicleNews(), AIInstance::Died(), GameInstance::Died(), DoAutoOrNetsave(), DrawSliderWidget(), ErrmsgWindow::DrawWidget(), RefitWindow::DrawWidget(), ErrorMessageData::ErrorMessageData(), GenerateTowns(), RefitWindow::GetCapacityString(), ObjectPickerCallbacks::GetClassName(), StationPickerCallbacks::GetClassName(), WaypointPickerCallbacks::GetClassName(), RoadStopPickerCallbacks< roadstoptype >::GetClassName(), RoadWaypointPickerCallbacks::GetClassName(), HousePickerCallbacks::GetClassName(), CommandCost::GetErrorMessage(), CommandCost::GetExtraErrorMessage(), ObjectPickerCallbacks::GetTypeName(), RoadStopPickerCallbacks< roadstoptype >::GetTypeName(), HousePickerCallbacks::GetTypeName(), GetVehicleCannotUseStationReason(), LoadCheckData::HasErrors(), LoadCheckData::HasNewGrfs(), LoadTownData(), CommandCost::MakeError(), NetworkValidateClientName(), NetworkValidateServerName(), AIConfigWindow::OnClick(), SelectCompanyManagerFaceWindow::OnClick(), SaveLoadWindow::OnClick(), GSConfigWindow::OnClick(), SelectGameWindow::OnClick(), NewGRFWindow::OnClick(), GameOptionsWindow::OnClick(), NetworkContentListWindow::OnConnect(), GameOptionsWindow::OnDropdownSelect(), RefitWindow::OnInvalidateData(), SelectCompanyManagerFaceWindow::OnQueryTextFinished(), SaveLoadWindow::OnTimeout(), RealMakeScreenshot(), ClientNetworkCoordinatorSocketHandler::Receive_GC_ERROR(), ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(), ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(), ClientNetworkGameSocketHandler::Receive_SERVER_ERROR(), ClientNetworkGameSocketHandler::Receive_SERVER_FULL(), ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(), ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(), ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(), RemoveBuoy(), TextEffect::Reset(), SaveOrLoad(), HousePickerCallbacks::SetClimateMask(), NIHObject::SetStringParameters(), NIHRailType::SetStringParameters(), NIHRoadType::SetStringParameters(), ShowBuildBridgeWindow(), ShowErrorMessage(), ShowEstimatedCostOrIncome(), ShowNewGRFError(), ShowScriptDebugWindow(), TownActionBribe(), ErrmsgWindow::UpdateWidgetSize(), WarnCorruptSprite(), and Vehicle::~Vehicle().

◆ MAX_CHAR_LENGTH

const int MAX_CHAR_LENGTH = 4
static

Max. length of UTF-8 encoded unicode character.

Definition at line 18 of file strings_type.h.

Referenced by ShowQueryString().

◆ MAX_LANG

const uint MAX_LANG = 0x7F
static

Maximum number of languages supported by the game, and the NewGRF specs.

Definition at line 19 of file strings_type.h.

Referenced by GlobalVarChangeInfo(), and LanguagePackHeader::IsValid().

◆ TAB_SIZE

const uint TAB_SIZE = 1 << TAB_SIZE_BITS
static

Number of strings per StringTab.

Definition at line 46 of file strings_type.h.

Referenced by StringData::CountInUse(), MakeStringID(), ReadLanguagePack(), and LanguageWriter::WriteLang().

◆ TAB_SIZE_BITS

const uint TAB_SIZE_BITS = 11
static

Number of bits for the StringIndex within a StringTab.

Definition at line 44 of file strings_type.h.

Referenced by GetStringIndex(), GetStringTab(), and MakeStringID().

◆ TAB_SIZE_GAMESCRIPT

const uint TAB_SIZE_GAMESCRIPT = TAB_SIZE * 32
static

Number of strings for GameScripts.

Definition at line 49 of file strings_type.h.

Referenced by FormatString(), and MakeStringID().

◆ TAB_SIZE_NEWGRF

const uint TAB_SIZE_NEWGRF = TAB_SIZE * 256
static

Number of strings for NewGRFs.

Definition at line 52 of file strings_type.h.

Referenced by AddGRFString(), and MakeStringID().