summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-11-24 11:20:07 +0000
committerrubidium <rubidium@openttd.org>2008-11-24 11:20:07 +0000
commit6878b181c7371ecc4af39eef6b01b710cc9f088b (patch)
tree06db0fdfd075a09707a8c1308125fb4ce774b75f
parentf28992719d8b3b554fda934f9d5cb11184e93da4 (diff)
downloadopenttd-6878b181c7371ecc4af39eef6b01b710cc9f088b.tar.xz
(svn r14617) -Change: unduplicate the languagepack(header).
-rw-r--r--src/strgen/strgen.cpp13
-rw-r--r--src/strgen/strgen.h22
-rw-r--r--src/strings.cpp12
3 files changed, 25 insertions, 22 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index ccf4c1398..298597311 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -7,6 +7,7 @@
#include "../core/endian_func.hpp"
#include "../string_func.h"
#include "../strings_type.h"
+#include "strgen.h"
#include "../table/control_codes.h"
#include <stdio.h>
@@ -35,18 +36,6 @@
typedef void (*ParseCmdProc)(char *buf, int value);
-struct LanguagePackHeader {
- uint32 ident; // 32-bits identifier
- 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 own_name[32]; // the localized name of this language
- char isocode[16]; // the ISO code for the language (not country code)
- uint16 offsets[32]; // the offsets
- byte plural_form; // plural form index
- byte text_dir; // default direction of the text
- byte pad[2]; // pad header to be a multiple of 4
-};
-
struct CmdStruct {
const char *cmd;
ParseCmdProc proc;
diff --git a/src/strgen/strgen.h b/src/strgen/strgen.h
new file mode 100644
index 000000000..a38b1760d
--- /dev/null
+++ b/src/strgen/strgen.h
@@ -0,0 +1,22 @@
+/* $Id$ */
+
+/** @file strgen.h Language pack header for strgen (needs to match). */
+
+#ifndef STRGEN_H
+#define STRGEN_H
+
+struct LanguagePackHeader {
+ uint32 ident; // 32-bits identifier
+ 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 own_name[32]; // the localized name of this language
+ char isocode[16]; // the ISO code for the language (not country code)
+ uint16 offsets[32]; // the offsets
+ byte plural_form; // plural form index
+ byte text_dir; // default direction of the text
+ byte pad[2]; // pad header to be a multiple of 4
+};
+
+assert_compile(sizeof(LanguagePackHeader) % 4 == 0);
+
+#endif /* STRGEN_H */
diff --git a/src/strings.cpp b/src/strings.cpp
index 8512a99c4..2fb3a7854 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -40,6 +40,7 @@
#include "engine_func.h"
#include "engine_base.h"
#include "saveload.h"
+#include "strgen/strgen.h"
#include "table/strings.h"
#include "table/control_codes.h"
@@ -53,16 +54,7 @@ static char *GetSpecialNameString(char *buff, int ind, const int64 *argv, const
static char *FormatString(char *buff, const char *str, const int64 *argv, uint casei, const char* last);
-struct LanguagePack {
- uint32 ident; // 32-bits identifier
- 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 own_name[32]; // the localized name of this language
- char isocode[16]; // the ISO code for the language (not country code)
- uint16 offsets[32]; // the offsets
- byte plural_form; // how to compute plural forms
- byte text_dir; // default direction of the text
- byte pad[2]; // pad header to be a multiple of 4
+struct LanguagePack : public LanguagePackHeader {
char data[VARARRAY_SIZE]; // list of strings
};