mirror of https://github.com/OpenTTD/OpenTTD
Codechange: C++ initialise LanguageHeaderPack
parent
8f1e94c546
commit
d70aeb72a7
|
@ -10,8 +10,6 @@
|
||||||
#ifndef MEM_FUNC_HPP
|
#ifndef MEM_FUNC_HPP
|
||||||
#define MEM_FUNC_HPP
|
#define MEM_FUNC_HPP
|
||||||
|
|
||||||
#include "math_func.hpp"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type-safe version of memcpy().
|
* Type-safe version of memcpy().
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,22 +24,22 @@ static const uint8_t MAX_NUM_CASES = 16; ///< Maximum number of supported case
|
||||||
struct LanguagePackHeader {
|
struct LanguagePackHeader {
|
||||||
static const uint32_t IDENT = 0x474E414C; ///< Identifier for OpenTTD language files, big endian for "LANG"
|
static const uint32_t IDENT = 0x474E414C; ///< Identifier for OpenTTD language files, big endian for "LANG"
|
||||||
|
|
||||||
uint32_t ident; ///< 32-bits identifier
|
uint32_t ident = 0; ///< 32-bits identifier
|
||||||
uint32_t version; ///< 32-bits of auto generated version info which is basically a hash of strings.h
|
uint32_t version = 0; ///< 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
|
||||||
char own_name[32]; ///< the localized name of this language
|
char own_name[32] = ""; ///< the localized name of this language
|
||||||
char isocode[16]; ///< the ISO code for the language (not country code)
|
char isocode[16] = ""; ///< the ISO code for the language (not country code)
|
||||||
uint16_t offsets[TEXT_TAB_END]; ///< the offsets
|
uint16_t offsets[TEXT_TAB_END] = {}; ///< the offsets
|
||||||
|
|
||||||
/** Thousand separator used for anything not currencies */
|
/** Thousand separator used for anything not currencies */
|
||||||
char digit_group_separator[8];
|
char digit_group_separator[8] = ",";
|
||||||
/** Thousand separator used for currencies */
|
/** Thousand separator used for currencies */
|
||||||
char digit_group_separator_currency[8];
|
char digit_group_separator_currency[8] = ",";
|
||||||
/** Decimal separator */
|
/** Decimal separator */
|
||||||
char digit_decimal_separator[8];
|
char digit_decimal_separator[8] = ".";
|
||||||
uint16_t missing; ///< number of missing strings.
|
uint16_t missing = 0; ///< number of missing strings.
|
||||||
uint8_t plural_form; ///< plural form index
|
uint8_t plural_form = 0; ///< plural form index
|
||||||
uint8_t text_dir; ///< default direction of the text
|
uint8_t text_dir = 0; ///< default direction of the text
|
||||||
/**
|
/**
|
||||||
* Windows language ID:
|
* Windows language ID:
|
||||||
* Windows cannot and will not convert isocodes to something it can use to
|
* Windows cannot and will not convert isocodes to something it can use to
|
||||||
|
@ -48,14 +48,14 @@ struct LanguagePackHeader {
|
||||||
* what language it is in "Windows". The ID is the 'locale identifier' on:
|
* what language it is in "Windows". The ID is the 'locale identifier' on:
|
||||||
* http://msdn.microsoft.com/en-us/library/ms776294.aspx
|
* http://msdn.microsoft.com/en-us/library/ms776294.aspx
|
||||||
*/
|
*/
|
||||||
uint16_t winlangid; ///< windows language id
|
uint16_t winlangid = 0; ///< windows language id
|
||||||
uint8_t newgrflangid; ///< newgrf language id
|
uint8_t newgrflangid = 0; ///< newgrf language id
|
||||||
uint8_t num_genders; ///< the number of genders of this language
|
uint8_t num_genders = 0; ///< the number of genders of this language
|
||||||
uint8_t num_cases; ///< the number of cases of this language
|
uint8_t num_cases = 0; ///< the number of cases of this language
|
||||||
uint8_t pad[3]; ///< pad header to be a multiple of 4
|
uint8_t pad[3] = {}; ///< pad header to be a multiple of 4
|
||||||
|
|
||||||
char genders[MAX_NUM_GENDERS][CASE_GENDER_LEN]; ///< the genders used by this translation
|
char genders[MAX_NUM_GENDERS][CASE_GENDER_LEN] = {}; ///< the genders used by this translation
|
||||||
char cases[MAX_NUM_CASES][CASE_GENDER_LEN]; ///< the cases used by this translation
|
char cases[MAX_NUM_CASES][CASE_GENDER_LEN] = {}; ///< the cases used by this translation
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
bool IsReasonablyFinished() const;
|
bool IsReasonablyFinished() const;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../stdafx.h"
|
#include "../stdafx.h"
|
||||||
#include "../core/endian_func.hpp"
|
#include "../core/endian_func.hpp"
|
||||||
#include "../core/mem_func.hpp"
|
#include "../core/mem_func.hpp"
|
||||||
|
#include "../core/math_func.hpp"
|
||||||
#include "../error_func.h"
|
#include "../error_func.h"
|
||||||
#include "../string_func.h"
|
#include "../string_func.h"
|
||||||
#include "../core/string_builder.hpp"
|
#include "../core/string_builder.hpp"
|
||||||
|
@ -588,10 +589,7 @@ void StringReader::ParseFile()
|
||||||
_strgen.file = this->file;
|
_strgen.file = this->file;
|
||||||
|
|
||||||
/* For each new file we parse, reset the genders, and language codes. */
|
/* For each new file we parse, reset the genders, and language codes. */
|
||||||
MemSetT(&_strgen.lang, 0);
|
_strgen.lang = {};
|
||||||
strecpy(_strgen.lang.digit_group_separator, ",");
|
|
||||||
strecpy(_strgen.lang.digit_group_separator_currency, ",");
|
|
||||||
strecpy(_strgen.lang.digit_decimal_separator, ".");
|
|
||||||
|
|
||||||
_strgen.cur_line = 1;
|
_strgen.cur_line = 1;
|
||||||
while (this->data.next_string_id < this->data.max_strings) {
|
while (this->data.next_string_id < this->data.max_strings) {
|
||||||
|
|
Loading…
Reference in New Issue