mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r21113) -Codechange: remove the amount of places where the language pack identifier magic value is
This commit is contained in:
parent
a89fed21c7
commit
28ed77c354
|
@ -946,7 +946,6 @@ static void WriteStringsH(const char *filename)
|
||||||
fprintf(_output_file, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n\n", next - 1);
|
fprintf(_output_file, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n\n", next - 1);
|
||||||
|
|
||||||
fprintf(_output_file,
|
fprintf(_output_file,
|
||||||
"static const uint LANGUAGE_PACK_IDENT = 0x474E414C; // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
|
|
||||||
"static const uint LANGUAGE_PACK_VERSION = 0x%X;\n\n", (uint)_hash
|
"static const uint LANGUAGE_PACK_VERSION = 0x%X;\n\n", (uint)_hash
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1069,8 +1068,7 @@ static void WriteLangfile(const char *filename)
|
||||||
_lang.offsets[i] = TO_LE16(n);
|
_lang.offsets[i] = TO_LE16(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see line 655: fprintf(..."\tLANGUAGE_PACK_IDENT = 0x474E414C,...) */
|
_lang.ident = TO_LE32(LanguagePackHeader::IDENT);
|
||||||
_lang.ident = TO_LE32(0x474E414C); // Big Endian value for 'LANG'
|
|
||||||
_lang.version = TO_LE32(_hash);
|
_lang.version = TO_LE32(_hash);
|
||||||
_lang.winlangid = TO_LE16(_lang.winlangid);
|
_lang.winlangid = TO_LE16(_lang.winlangid);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
/** Header of a language file. */
|
/** Header of a language file. */
|
||||||
struct LanguagePackHeader {
|
struct LanguagePackHeader {
|
||||||
|
static const uint32 IDENT = 0x474E414C; ///< Identifier for OpenTTD language files, big endian for "LANG"
|
||||||
|
|
||||||
uint32 ident; ///< 32-bits identifier
|
uint32 ident; ///< 32-bits identifier
|
||||||
uint32 version; ///< 32-bits of auto generated version info which is basically a hash of strings.h
|
uint32 version; ///< 32-bits of auto generated version info which is basically a hash of strings.h
|
||||||
char name[32]; ///< the international name of this language
|
char name[32]; ///< the international name of this language
|
||||||
|
|
|
@ -1314,7 +1314,7 @@ bool ReadLanguagePack(int lang_index)
|
||||||
|
|
||||||
/* We need at least one byte of lang_pack->data */
|
/* We need at least one byte of lang_pack->data */
|
||||||
if (end <= lang_pack->data ||
|
if (end <= lang_pack->data ||
|
||||||
lang_pack->ident != TO_LE32(LANGUAGE_PACK_IDENT) ||
|
lang_pack->ident != TO_LE32(LanguagePackHeader::IDENT) ||
|
||||||
lang_pack->version != TO_LE32(LANGUAGE_PACK_VERSION)) {
|
lang_pack->version != TO_LE32(LANGUAGE_PACK_VERSION)) {
|
||||||
free(lang_pack);
|
free(lang_pack);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1453,7 +1453,7 @@ static bool GetLanguageFileHeader(const char *file, LanguagePack *hdr)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
bool ret = read == 1 &&
|
bool ret = read == 1 &&
|
||||||
hdr->ident == TO_LE32(LANGUAGE_PACK_IDENT) &&
|
hdr->ident == TO_LE32(LanguagePackHeader::IDENT) &&
|
||||||
hdr->version == TO_LE32(LANGUAGE_PACK_VERSION);
|
hdr->version == TO_LE32(LANGUAGE_PACK_VERSION);
|
||||||
|
|
||||||
/* Convert endianness for the windows language ID */
|
/* Convert endianness for the windows language ID */
|
||||||
|
|
Loading…
Reference in New Issue