summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-16 21:03:39 +0000
committerrubidium <rubidium@openttd.org>2010-11-16 21:03:39 +0000
commit18f0f1d81d06fc504965a6bedcd8e20e06b96bd7 (patch)
tree57e3a40fceab94873fa88cc21df5479991b27653 /src/newgrf.cpp
parentebf7b915b0dee963e5398de8e06a0377c49142e6 (diff)
downloadopenttd-18f0f1d81d06fc504965a6bedcd8e20e06b96bd7.tar.xz
(svn r21216) -Feature: [NewGRF] Allow specifying a "choice list" for plurals
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 0b9382732..fca8f96bf 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1911,7 +1911,8 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
break;
case 0x13: // Gender translation table
- case 0x14: { // Case translation table
+ case 0x14: // Case translation table
+ case 0x15: { // Plural form translation
uint curidx = gvid + i; // The current index, i.e. language.
const LanguageMetadata *lang = curidx < MAX_LANG ? GetLanguage(curidx) : NULL;
if (lang == NULL) {
@@ -1925,6 +1926,16 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By
if (_cur_grffile->language_map == NULL) _cur_grffile->language_map = new LanguageMap[MAX_LANG];
+ if (prop == 0x15) {
+ uint plural_form = buf->ReadByte();
+ if (plural_form >= LANGUAGE_MAX_PLURAL) {
+ grfmsg(1, "GlobalVarChanceInfo: Plural form %d is out of range, ignoring", plural_form);
+ } else {
+ _cur_grffile->language_map[curidx].plural_form = plural_form;
+ }
+ break;
+ }
+
byte newgrf_id = buf->ReadByte(); // The NewGRF (custom) identifier.
while (newgrf_id != 0) {
const char *name = buf->ReadString(); // The name for the OpenTTD identifier.
@@ -1975,6 +1986,7 @@ static ChangeInfoResult GlobalVarReserveInfo(uint gvid, int numinfo, int prop, B
for (int i = 0; i < numinfo; i++) {
switch (prop) {
case 0x08: // Cost base factor
+ case 0x15: // Plural form translation
buf->ReadByte();
break;