OpenTTD: src/language.h File Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Data Structures | Typedefs | Functions | Variables
language.h File Reference

Information about languages and their files. More...

`#include "core/smallvec_type.hpp"`

Go to the source code of this file.

## Data Structures
struct | LanguagePackHeader
| Header of a language file. More...
struct | LanguageMetadata
| Metadata about a single language. More...

## Typedefs
typedef SmallVector < LanguageMetadata, 4 > | LanguageList
| Type for the list of language meta data.

## Functions
| assert_compile (sizeof(LanguagePackHeader)%4==0)
| Make sure the size is right.
bool | ReadLanguagePack (const LanguageMetadata *lang)
| Read a particular language.
const LanguageMetadata * | GetLanguage (byte newgrflangid)
| Get the language with the given NewGRF language ID.

## Variables
static const uint8 | CASE_GENDER_LEN = 16
| The (maximum) length of a case/gender string.
static const uint8 | MAX_NUM_GENDERS = 8
| Maximum number of supported genders.
static const uint8 | MAX_NUM_CASES = 16
| Maximum number of supported cases.
static const uint | TAB_SIZE_OFFSET = 0
| The offset for the tab size.
static const uint | TAB_SIZE_BITS = 11
| The number of bits used for the tab size.
static const uint | TAB_SIZE = 1 << TAB_SIZE_BITS
| The number of values in a tab.
static const uint | TAB_COUNT_OFFSET = TAB_SIZE_BITS
| The offset for the tab count.
static const uint | TAB_COUNT_BITS = 5
| The number of bits used for the amount of tabs.
static const uint | TAB_COUNT = 1 << TAB_COUNT_BITS
| The amount of tabs.
LanguageList | _languages
| The actual list of language meta data.
const LanguageMetadata * | _current_language
| The currently loaded language.

## Detailed Description

Information about languages and their files.

Definition in file language.h.

## Typedef Documentation

typedef SmallVector<LanguageMetadata, 4> LanguageList

Type for the list of language meta data.

Definition at line 105 of file language.h.

## Function Documentation

assert_compile | ( | sizeof(LanguagePackHeader)% | 4 = `=0` | ) |

Make sure the size is right.

const LanguageMetadata* GetLanguage | ( | byte | newgrflangid | ) |

Get the language with the given NewGRF language ID.

Parameters

  newgrflangid | NewGRF languages ID to check.

Returns
  The language's metadata, or NULL if it is not known.

Definition at line 1877 of file strings.cpp.

References SmallVector< T, S >::Begin(), and SmallVector< T, S >::End().

Referenced by GetLanguageList(), and GlobalVarChangeInfo().

bool ReadLanguagePack | ( | const LanguageMetadata * | lang | ) |

Read a particular language.

Parameters

  lang | The metadata about the language.

Returns
  Whether the loading went okay or not.

Definition at line 1720 of file strings.cpp.

References _config_language_file, _current_text_dir, _langtab_num, _langtab_start, BuildContentTypeStringList(), BuildIndustriesLegend(), LanguageMetadata::file, free(), InitializeSortedCargoSpecs(), InvalidateWindowClassesData(), LanguagePackHeader::isocode, LanguagePackHeader::IsValid(), lastof, LanguagePackHeader::newgrflangid, LanguagePackHeader::offsets, ReadFileToMem(), ReconsiderGameScriptLanguage(), SetCurrentGrfLangID(), SortIndustryTypes(), strecpy(), TAB_COUNT, TAB_SIZE, LanguagePackHeader::text_dir, WC_AIRCRAFT_LIST, WC_BUILD_VEHICLE, WC_INDUSTRY_DIRECTORY, WC_ROADVEH_LIST, WC_SHIPS_LIST, WC_STATION_LIST, and WC_TRAINS_LIST.

Referenced by InitializeLanguagePacks(), and GameOptionsWindow::OnDropdownSelect().

## Variable Documentation

const LanguageMetadata* _current_language

The currently loaded language.

Definition at line 48 of file strings.cpp.

Referenced by GameOptionsWindow::BuildDropDownList(), SelectGameWindow::DrawWidget(), UnmappedChoiceList::Flush(), CrashLog::LogConfiguration(), SelectGameWindow::OnInit(), ReconsiderGameScriptLanguage(), GameOptionsWindow::SetStringParameters(), and SelectGameWindow::UpdateWidgetSize().

LanguageList _languages

The actual list of language meta data.

Definition at line 47 of file strings.cpp.

Referenced by GameOptionsWindow::BuildDropDownList(), and GameOptionsWindow::OnDropdownSelect().