diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-21 08:11:50 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-21 08:11:50 +0000 |
commit | 91aab561617e3ebdc24648d454254e7e747de3d1 (patch) | |
tree | 724df919e71f874f6b4d5a2ae5765fbbe4b26362 | |
parent | a98818cc6dc34800c88a880f3b67cd7afd7f9934 (diff) | |
download | openttd-91aab561617e3ebdc24648d454254e7e747de3d1.tar.xz |
(svn r4497) - NewGRF minor fixes: (Rubidium)
- Remove a define in favour of using the lengthof() an array.
- Fix typos in language names enum.
- Add Brazilian ISO code.
-rw-r--r-- | newgrf_text.c | 25 | ||||
-rw-r--r-- | newgrf_text.h | 2 |
2 files changed, 14 insertions, 13 deletions
diff --git a/newgrf_text.c b/newgrf_text.c index 95105c248..c3250fc4c 100644 --- a/newgrf_text.c +++ b/newgrf_text.c @@ -44,7 +44,7 @@ typedef enum grf_extended_languages { GRFLX_RUSSIAN = 0x07, GRFLX_CZECH = 0x15, GRFLX_SLOVAK = 0x16, - GRFLX_DEUTCH = 0x1F, + GRFLX_DUTCH = 0x1F, GRFLX_CATALAN = 0x22, GRFLX_HUNGARIAN = 0x24, GRFLX_ITALIAN = 0x27, @@ -54,7 +54,7 @@ typedef enum grf_extended_languages { GRFLX_LITHUANIAN = 0x2B, GRFLX_SLOVENIAN = 0x2C, GRFLX_DANISH = 0x2D, - GRFLX_SEWDISH = 0x2E, + GRFLX_SWEDISH = 0x2E, GRFLX_NORWEGIAN = 0x2F, GRFLX_POLISH = 0x30, GRFLX_GALICIAN = 0x31, @@ -62,7 +62,7 @@ typedef enum grf_extended_languages { GRFLX_ESTONIAN = 0x34, GRFLX_FINNISH = 0x35, GRFLX_PORTUGUESE = 0x36, - GRFLX_BRAZIZILAN = 0x37, + GRFLX_BRAZILIAN = 0x37, GRFLX_TURKISH = 0x3E, } grf_language; @@ -80,7 +80,7 @@ typedef struct iso_grf { * 2-its shift part is used to know what is the shift to * watch for when inserting new strings, hence analysing newgrf langid */ -const iso_grf iso_codes[MAX_LANG] = { +const iso_grf iso_codes[] = { {"en_US", GRFLX_AMERICAN}, {"en_GB", GRFLX_ENGLISH}, {"de", GRFLX_GERMAN}, @@ -89,7 +89,7 @@ const iso_grf iso_codes[MAX_LANG] = { {"cs", GRFLX_CZECH}, {"ca", GRFLX_CATALAN}, {"da", GRFLX_DANISH}, - {"nl", GRFLX_DEUTCH}, + {"nl", GRFLX_DUTCH}, {"et", GRFLX_ESTONIAN}, {"fi", GRFLX_FINNISH}, {"fy", GRFLX_FRISIAN}, @@ -102,11 +102,12 @@ const iso_grf iso_codes[MAX_LANG] = { {"nb", GRFLX_NORWEGIAN}, {"pl", GRFLX_POLISH}, {"pt", GRFLX_PORTUGUESE}, + {"pt_BR", GRFLX_BRAZILIAN}, {"ro", GRFLX_ROMANIAN}, {"ru", GRFLX_RUSSIAN}, {"sk", GRFLX_SLOVAK}, {"sl", GRFLX_SLOVENIAN}, - {"sv", GRFLX_SEWDISH}, + {"sv", GRFLX_SWEDISH}, {"tr", GRFLX_TURKISH}, {"gen", GRFLB_GENERIC} //this is not iso code, but there has to be something... }; @@ -221,15 +222,17 @@ char *GetGRFString(char *buff, uint16 stringid) * from strings.c:ReadLanguagePack * @param iso code of current selection */ -void SetCurrentGrfLangID( const char *iso_name ) +void SetCurrentGrfLangID(const char *iso_name) { byte ret,i; - ret = GRFLX_ENGLISH; //by default, english (not american) will be used + /* Use English by default, if we can't match up the iso_code. */ + ret = GRFLX_ENGLISH; - for (i=0; i < MAX_LANG+1; i++) { - if (strcmp(iso_codes[i].code, iso_name)==0){ //we have a match? - ret = i; //we'll use this one then. + for (i=0; i < lengthof(iso_codes); i++) { + if (strcmp(iso_codes[i].code, iso_name) == 0) { + /* We found a match, so let's use it. */ + ret = i; break; } } diff --git a/newgrf_text.h b/newgrf_text.h index 2eed88ccb..5d43c4ae2 100644 --- a/newgrf_text.h +++ b/newgrf_text.h @@ -6,8 +6,6 @@ * Header of Action 04 "universal holder" structure and functions */ -#define MAX_LANG 28 - /** * Element of the linked list. * Each of those elements represent the string, |