summaryrefslogtreecommitdiff
path: root/newgrf.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-10-28 18:42:57 +0000
committerpeter1138 <peter1138@openttd.org>2006-10-28 18:42:57 +0000
commitdc58fb87ab97783bfc9e35c62719afd45fadb5c1 (patch)
treec1619e47b26eecbb69972264cf6b77808e2283b8 /newgrf.c
parent8908ea67d5d01f1a00e3d4d507ada67bc47bec9b (diff)
downloadopenttd-dc58fb87ab97783bfc9e35c62719afd45fadb5c1.tar.xz
(svn r6995) - Codechange: NewGRF; strip bit 7 of the language ID earlier and handle handle a language ID of 0x7F as the preferred default language.
Diffstat (limited to 'newgrf.c')
-rw-r--r--newgrf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/newgrf.c b/newgrf.c
index 53224f533..101025d29 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -1961,13 +1961,17 @@ static void FeatureNewName(byte *buf, int len)
uint16 endid;
const char* name;
bool new_scheme = _cur_grffile->grf_version >= 7;
+ bool generic;
check_length(len, 6, "FeatureNewName");
buf++;
feature = grf_load_byte(&buf);
lang = grf_load_byte(&buf);
num = grf_load_byte(&buf);
- id = (lang & 0x80) ? grf_load_word(&buf) : grf_load_byte(&buf);
+ generic = HASBIT(lang, 7);
+ id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
+
+ CLRBIT(lang, 7);
if (feature <= GSF_AIRCRAFT && id < _vehcounts[feature]) {
id += _vehshifts[feature];
@@ -1978,7 +1982,8 @@ static void FeatureNewName(byte *buf, int len)
id, endid, feature, lang);
name = (const char*)buf; /*transfer read value*/
- len -= (lang & 0x80) ? 6 : 5;
+ len -= generic ? 6 : 5;
+
for (; id < endid && len > 0; id++) {
size_t ofs = strlen(name) + 1;