OpenTTD Source: src/game/game_text.hpp File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Functions
game_text.hpp File Reference

Base functions regarding game texts. More...

`#include "../string_type.h"`
`#include "../strings_type.h"`

Go to the source code of this file.

## Data Structures
struct | StringParam
struct | LanguageStrings
| Container for the raw (unencoded) language strings of a language. More...
struct | GameStrings
| Container for all the game strings. More...

## Typedefs
using | StringParams = std::vector< StringParam >
using | StringParamsList = std::vector< StringParams >

## Functions
std::string_view | GetGameStringPtr (StringIndexInTab id)
| Get the string pointer of a particular game string.
const StringParams & | GetGameStringParams (StringIndexInTab id)
| Get the string parameters of a particular game string.
const std::string & | GetGameStringName (StringIndexInTab id)
| Get the name of a particular game string.
void | RegisterGameTranslation (class Squirrel &engine)
| Register the current translation to the Squirrel engine.
void | ReconsiderGameScriptLanguage ()
| Reconsider the game script language, so we use the right one.

## Detailed Description

Base functions regarding game texts.

Definition in file game_text.hpp.

## Typedef Documentation

## ◆ StringParams

using StringParams = std::vector<StringParam>

Definition at line 30 of file game_text.hpp.

## ◆ StringParamsList

using StringParamsList = std::vector<StringParams>

Definition at line 31 of file game_text.hpp.

## Function Documentation

## ◆ GetGameStringName()

const std::string & GetGameStringName | ( | StringIndexInTab | id | ) |

Get the name of a particular game string.

Parameters

  id | The ID of the game string.

Returns
  The name of the string.

Definition at line 340 of file game_text.cpp.

References _current_gamestrings_data.

## ◆ GetGameStringParams()

const StringParams & GetGameStringParams | ( | StringIndexInTab | id | ) |

Get the string parameters of a particular game string.

Parameters

  id | The ID of the game string.

Returns
  The string parameters.

Definition at line 326 of file game_text.cpp.

References _current_gamestrings_data.

## ◆ GetGameStringPtr()

std::string_view GetGameStringPtr | ( | StringIndexInTab | id | ) |

Get the string pointer of a particular game string.

Parameters

  id | The ID of the game string.

Returns
  The encoded string.

Definition at line 315 of file game_text.cpp.

References _current_gamestrings_data.

Referenced by GetStringWithArgs().

## ◆ ReconsiderGameScriptLanguage()

void ReconsiderGameScriptLanguage | ( |  | ) |

Reconsider the game script language, so we use the right one.

Definition at line 381 of file game_text.cpp.

References _current_gamestrings_data, _current_language, LanguageMetadata::file, and FS2OTTD().

Referenced by GSTRChunkHandler::Load(), ReadLanguagePack(), and RegisterGameTranslation().

## ◆ RegisterGameTranslation()

void RegisterGameTranslation | ( | Squirrel & | engine | ) |

Register the current translation to the Squirrel engine.

Parameters

  engine | The engine to update/

Definition at line 353 of file game_text.cpp.

References _current_gamestrings_data, Squirrel::GetVM(), LoadTranslations(), and ReconsiderGameScriptLanguage().

Referenced by GameInstance::RegisterAPI().