diff options
Diffstat (limited to 'src/newgrf_text.h')
-rw-r--r-- | src/newgrf_text.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/newgrf_text.h b/src/newgrf_text.h index 2865bf706..90fcd719a 100644 --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -14,6 +14,7 @@ #include "string_type.h" #include "strings_type.h" +#include "core/smallvec_type.hpp" /** This character, the thorn ('รพ'), indicates a unicode string to NFO. */ static const WChar NFO_UTF8_IDENTIFIER = 0x00DE; @@ -42,4 +43,22 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const StringID TTDPStringIDToOTTDStringIDMapping(StringID string); +/** Mapping of language data between a NewGRF and OpenTTD. */ +struct LanguageMap { + /** Mapping between NewGRF and OpenTTD IDs. */ + struct Mapping { + byte newgrf_id; ///< NewGRF's internal ID for a case/gender. + byte openttd_id; ///< OpenTTD's internal ID for a case/gender. + }; + + /* We need a vector and can't use SmallMap due to the fact that for "setting" a + * gender of a string or requesting a case for a substring we want to map from + * the NewGRF's internal ID to OpenTTD's ID whereas for the choice lists we map + * the genders/cases/plural OpenTTD IDs to the NewGRF's internal IDs. In this + * case a NewGRF developer/translator might want a different translation for + * both cases. Thus we are basically implementing a multi-map. */ + 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. +}; + #endif /* NEWGRF_TEXT_H */ |