Data Structures | Public Member Functions | Static Public Member Functions | Data Fields

# LanguageMap Struct Reference

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

`#include <newgrf_text.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 LanguageMap * | GetLanguageMap (uint32 grfid, uint8 language_id)
| Get the language map associated with a given NewGRF and language.
## Data Fields
SmallVector< Mapping, 1 > | gender_map
| Mapping of NewGRF and OpenTTD IDs for genders.
SmallVector< Mapping, 1 > | case_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 49 of file newgrf_text.h.

## Member Function Documentation

const LanguageMap * LanguageMap::GetLanguageMap | ( | uint32 | grfid,
|  | uint8 | language_id |
| ) |  |  | `[static]`

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

Parameters:

  | grfid | The NewGRF to get the map for.
  | language_id | The (NewGRF) language ID to get the map for.

Returns:
  The LanguageMap, or NULL if it couldn't be found.

Definition at line 2415 of file newgrf.cpp.

References GetFileByGRFID(), GRFFile::language_map, and MAX_LANG.

Referenced by TranslateTTDPatchCodes().

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

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

Parameters:

  | newgrf_id | The NewGRF ID to map.
  | gender | Whether to map genders or cases.

Returns:
  The, to OpenTTD's internal ID, mapped index, or -1 if there is no mapping.

Definition at line 232 of file newgrf_text.cpp.

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

Referenced by TranslateTTDPatchCodes().

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

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

Parameters:

  | openttd_id | The OpenTTD ID to map.
  | gender | Whether to map genders or cases.

Returns:
  The, to the NewGRF supplied ID, mapped index, or -1 if there is no mapping.

Definition at line 247 of file newgrf_text.cpp.

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

Referenced by UnmappedChoiceList::Flush().

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

- src/newgrf_text.h
- src/newgrf.cpp
- src/newgrf_text.cpp