summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-16 14:00:02 +0000
committerrubidium <rubidium@openttd.org>2010-11-16 14:00:02 +0000
commit0f9c40244a28e90a1c3f774354bdc3d07b149f21 (patch)
treee0d3306de20dd4e128f13ea597f12c4d2e78c596 /src/newgrf.cpp
parent0500c92003282382c2b0e66c7168ba7319c65b25 (diff)
downloadopenttd-0f9c40244a28e90a1c3f774354bdc3d07b149f21.tar.xz
(svn r21209) -Feature: [NewGRF] Allow setting the gender of the current string or select the case of the next substring
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp13
1 files changed, 13 insertions, 0 deletions
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;