From 0f9c40244a28e90a1c3f774354bdc3d07b149f21 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 16 Nov 2010 14:00:02 +0000 Subject: (svn r21209) -Feature: [NewGRF] Allow setting the gender of the current string or select the case of the next substring --- src/newgrf.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/newgrf.cpp') diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 6c758c9dd..0b9382732 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1765,6 +1765,19 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt return ret; } +/** + * Get the language map associated with a given NewGRF and language. + * @param grfid The NewGRF to get the map for. + * @param language_id The (NewGRF) language ID to get the map for. + * @return the LanguageMap, or NULL if it couldn't be found. + */ +/* static */ const LanguageMap *LanguageMap::GetLanguageMap(uint32 grfid, uint8 language_id) +{ + /* LanguageID "MAX_LANG", i.e. 7F is any. This language can't have a gender/case mapping, but has to be handled gracefully. */ + const GRFFile *grffile = GetFileByGRFID(grfid); + return (grffile != NULL && grffile->language_map != NULL && language_id < MAX_LANG) ? &grffile->language_map[language_id] : NULL; +} + static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, ByteReader *buf) { ChangeInfoResult ret = CIR_SUCCESS; -- cgit v1.2.3-54-g00ecf