mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(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.
This commit is contained in:
parent
ae94d7b26f
commit
a0a2feeda5
@ -44,7 +44,7 @@ typedef enum grf_extended_languages {
|
|||||||
GRFLX_RUSSIAN = 0x07,
|
GRFLX_RUSSIAN = 0x07,
|
||||||
GRFLX_CZECH = 0x15,
|
GRFLX_CZECH = 0x15,
|
||||||
GRFLX_SLOVAK = 0x16,
|
GRFLX_SLOVAK = 0x16,
|
||||||
GRFLX_DEUTCH = 0x1F,
|
GRFLX_DUTCH = 0x1F,
|
||||||
GRFLX_CATALAN = 0x22,
|
GRFLX_CATALAN = 0x22,
|
||||||
GRFLX_HUNGARIAN = 0x24,
|
GRFLX_HUNGARIAN = 0x24,
|
||||||
GRFLX_ITALIAN = 0x27,
|
GRFLX_ITALIAN = 0x27,
|
||||||
@ -54,7 +54,7 @@ typedef enum grf_extended_languages {
|
|||||||
GRFLX_LITHUANIAN = 0x2B,
|
GRFLX_LITHUANIAN = 0x2B,
|
||||||
GRFLX_SLOVENIAN = 0x2C,
|
GRFLX_SLOVENIAN = 0x2C,
|
||||||
GRFLX_DANISH = 0x2D,
|
GRFLX_DANISH = 0x2D,
|
||||||
GRFLX_SEWDISH = 0x2E,
|
GRFLX_SWEDISH = 0x2E,
|
||||||
GRFLX_NORWEGIAN = 0x2F,
|
GRFLX_NORWEGIAN = 0x2F,
|
||||||
GRFLX_POLISH = 0x30,
|
GRFLX_POLISH = 0x30,
|
||||||
GRFLX_GALICIAN = 0x31,
|
GRFLX_GALICIAN = 0x31,
|
||||||
@ -62,7 +62,7 @@ typedef enum grf_extended_languages {
|
|||||||
GRFLX_ESTONIAN = 0x34,
|
GRFLX_ESTONIAN = 0x34,
|
||||||
GRFLX_FINNISH = 0x35,
|
GRFLX_FINNISH = 0x35,
|
||||||
GRFLX_PORTUGUESE = 0x36,
|
GRFLX_PORTUGUESE = 0x36,
|
||||||
GRFLX_BRAZIZILAN = 0x37,
|
GRFLX_BRAZILIAN = 0x37,
|
||||||
GRFLX_TURKISH = 0x3E,
|
GRFLX_TURKISH = 0x3E,
|
||||||
} grf_language;
|
} grf_language;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ typedef struct iso_grf {
|
|||||||
* 2-its shift part is used to know what is the shift to
|
* 2-its shift part is used to know what is the shift to
|
||||||
* watch for when inserting new strings, hence analysing newgrf langid
|
* 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_US", GRFLX_AMERICAN},
|
||||||
{"en_GB", GRFLX_ENGLISH},
|
{"en_GB", GRFLX_ENGLISH},
|
||||||
{"de", GRFLX_GERMAN},
|
{"de", GRFLX_GERMAN},
|
||||||
@ -89,7 +89,7 @@ const iso_grf iso_codes[MAX_LANG] = {
|
|||||||
{"cs", GRFLX_CZECH},
|
{"cs", GRFLX_CZECH},
|
||||||
{"ca", GRFLX_CATALAN},
|
{"ca", GRFLX_CATALAN},
|
||||||
{"da", GRFLX_DANISH},
|
{"da", GRFLX_DANISH},
|
||||||
{"nl", GRFLX_DEUTCH},
|
{"nl", GRFLX_DUTCH},
|
||||||
{"et", GRFLX_ESTONIAN},
|
{"et", GRFLX_ESTONIAN},
|
||||||
{"fi", GRFLX_FINNISH},
|
{"fi", GRFLX_FINNISH},
|
||||||
{"fy", GRFLX_FRISIAN},
|
{"fy", GRFLX_FRISIAN},
|
||||||
@ -102,11 +102,12 @@ const iso_grf iso_codes[MAX_LANG] = {
|
|||||||
{"nb", GRFLX_NORWEGIAN},
|
{"nb", GRFLX_NORWEGIAN},
|
||||||
{"pl", GRFLX_POLISH},
|
{"pl", GRFLX_POLISH},
|
||||||
{"pt", GRFLX_PORTUGUESE},
|
{"pt", GRFLX_PORTUGUESE},
|
||||||
|
{"pt_BR", GRFLX_BRAZILIAN},
|
||||||
{"ro", GRFLX_ROMANIAN},
|
{"ro", GRFLX_ROMANIAN},
|
||||||
{"ru", GRFLX_RUSSIAN},
|
{"ru", GRFLX_RUSSIAN},
|
||||||
{"sk", GRFLX_SLOVAK},
|
{"sk", GRFLX_SLOVAK},
|
||||||
{"sl", GRFLX_SLOVENIAN},
|
{"sl", GRFLX_SLOVENIAN},
|
||||||
{"sv", GRFLX_SEWDISH},
|
{"sv", GRFLX_SWEDISH},
|
||||||
{"tr", GRFLX_TURKISH},
|
{"tr", GRFLX_TURKISH},
|
||||||
{"gen", GRFLB_GENERIC} //this is not iso code, but there has to be something...
|
{"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
|
* from strings.c:ReadLanguagePack
|
||||||
* @param iso code of current selection
|
* @param iso code of current selection
|
||||||
*/
|
*/
|
||||||
void SetCurrentGrfLangID( const char *iso_name )
|
void SetCurrentGrfLangID(const char *iso_name)
|
||||||
{
|
{
|
||||||
byte ret,i;
|
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++) {
|
for (i=0; i < lengthof(iso_codes); i++) {
|
||||||
if (strcmp(iso_codes[i].code, iso_name)==0){ //we have a match?
|
if (strcmp(iso_codes[i].code, iso_name) == 0) {
|
||||||
ret = i; //we'll use this one then.
|
/* We found a match, so let's use it. */
|
||||||
|
ret = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
* Header of Action 04 "universal holder" structure and functions
|
* Header of Action 04 "universal holder" structure and functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_LANG 28
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element of the linked list.
|
* Element of the linked list.
|
||||||
* Each of those elements represent the string,
|
* Each of those elements represent the string,
|
||||||
|
Loading…
Reference in New Issue
Block a user