OpenTTD Source 20241224-master-gf74b0cf984
LanguageMap Struct Reference

Mapping of language data between a NewGRF and OpenTTD. More...

#include <newgrf_text_type.h>

Data Structures

struct  Mapping
 Mapping between NewGRF and OpenTTD IDs. More...
 

Public Member Functions

int GetMapping (int newgrf_id, bool gender) const
 Get the mapping from the NewGRF supplied ID to OpenTTD's internal ID.
 
int GetReverseMapping (int openttd_id, bool gender) const
 Get the mapping from OpenTTD's internal ID to the NewGRF supplied ID.
 

Static Public Member Functions

static const LanguageMapGetLanguageMap (uint32_t grfid, uint8_t language_id)
 Get the language map associated with a given NewGRF and language.
 

Data Fields

std::vector< Mappinggender_map
 Mapping of NewGRF and OpenTTD IDs for genders.
 
std::vector< Mappingcase_map
 Mapping of NewGRF and OpenTTD IDs for cases.
 
int plural_form
 The plural form used for this language.
 

Detailed Description

Mapping of language data between a NewGRF and OpenTTD.

Definition at line 28 of file newgrf_text_type.h.

Member Function Documentation

◆ GetLanguageMap()

const LanguageMap * LanguageMap::GetLanguageMap ( uint32_t  grfid,
uint8_t  language_id 
)
static

Get the language map associated with a given NewGRF and language.

Parameters
grfidThe NewGRF to get the map for.
language_idThe (NewGRF) language ID to get the map for.
Returns
The LanguageMap, or nullptr if it couldn't be found.

Definition at line 2687 of file newgrf.cpp.

References GetFileByGRFID(), and GRFFile::language_map.

Referenced by TranslateTTDPatchCodes().

◆ GetMapping()

int LanguageMap::GetMapping ( int  newgrf_id,
bool  gender 
) const

Get the mapping from the NewGRF supplied ID to OpenTTD's internal ID.

Parameters
newgrf_idThe NewGRF ID to map.
genderWhether to map genders or cases.
Returns
The, to OpenTTD's internal ID, mapped index, or -1 if there is no mapping.

Definition at line 83 of file newgrf_text.cpp.

References case_map, and gender_map.

Referenced by TranslateTTDPatchCodes().

◆ GetReverseMapping()

int LanguageMap::GetReverseMapping ( int  openttd_id,
bool  gender 
) const

Get the mapping from OpenTTD's internal ID to the NewGRF supplied ID.

Parameters
openttd_idThe OpenTTD ID to map.
genderWhether to map genders or cases.
Returns
The, to the NewGRF supplied ID, mapped index, or -1 if there is no mapping.

Definition at line 98 of file newgrf_text.cpp.

References case_map, and gender_map.

Referenced by UnmappedChoiceList::Flush().

Field Documentation

◆ case_map

std::vector<Mapping> LanguageMap::case_map

Mapping of NewGRF and OpenTTD IDs for cases.

Definition at line 42 of file newgrf_text_type.h.

Referenced by GetMapping(), and GetReverseMapping().

◆ gender_map

std::vector<Mapping> LanguageMap::gender_map

Mapping of NewGRF and OpenTTD IDs for genders.

Definition at line 41 of file newgrf_text_type.h.

Referenced by GetMapping(), and GetReverseMapping().

◆ plural_form

int LanguageMap::plural_form

The plural form used for this language.

Definition at line 43 of file newgrf_text_type.h.

Referenced by UnmappedChoiceList::Flush().


The documentation for this struct was generated from the following files: