4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file game_text.hpp Base functions regarding game texts. */
16 #include "../core/pointer.h"
18 const char *GetGameStringPtr(uint id
);
19 void RegisterGameTranslation(class Squirrel
*engine
);
20 void ReconsiderGameScriptLanguage();
22 /** Container for the raw (unencoded) language strings of a language. */
23 struct LanguageStrings
{
24 const ttd_unique_free_ptr
<char> language
; ///< Name of the language (base filename).
26 /** Helper class to store a vector of unique strings. */
27 struct StringVector
: std::vector
<ttd_unique_free_ptr
<char> > {
28 /** Append a newly allocated string to the vector. */
31 this->push_back (ttd_unique_free_ptr
<char> (s
));
35 StringVector raw
; ///< The raw strings of the language.
36 StringVector compiled
; ///< The compiled strings of the language.
38 /** Create a new container for language strings. */
39 LanguageStrings (void) : language (xstrdup (""))
44 * Create a new container for language strings.
45 * @param language The language name.
47 LanguageStrings (char *language
) : language (language
)
52 /** Container for all the game strings. */
54 uint version
; ///< The version of the language strings.
55 LanguageStrings
*cur_language
; ///< The current (compiled) language.
57 /** Helper class to store a vector of LanguageStrings. */
58 struct LanguageVector
: std::vector
<ttd_unique_ptr
<LanguageStrings
> > {
59 /** Append a newly constructed LanguageStrings to the vector. */
60 void append (LanguageStrings
*ls
)
62 this->push_back (ttd_unique_ptr
<LanguageStrings
> (ls
));
66 LanguageVector strings
; ///< The strings per language, first is master.
68 /** Helper class to store a vector of unique strings. */
69 struct StringVector
: std::vector
<ttd_unique_free_ptr
<char> > {
70 /** Append a newly allocated string to the vector. */
73 this->push_back (ttd_unique_free_ptr
<char> (s
));
77 StringVector string_names
; ///< The names of the compiled strings.
81 static GameStrings
*current
;
84 #endif /* GAME_TEXT_HPP */