From 0500c92003282382c2b0e66c7168ba7319c65b25 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 16 Nov 2010 12:47:22 +0000 Subject: (svn r21208) -Add: [NewGRF] Mapping information w.r.t. a translation's case and gender names --- src/newgrf_text.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/newgrf_text.h') 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 gender_map; ///< Mapping of NewGRF and OpenTTD IDs for genders. + SmallVector case_map; ///< Mapping of NewGRF and OpenTTD IDs for cases. +}; + #endif /* NEWGRF_TEXT_H */ -- cgit v1.2.3-54-g00ecf