OpenTTD
game_text.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef GAME_TEXT_HPP
11 #define GAME_TEXT_HPP
12 
13 #include "../core/smallvec_type.hpp"
14 
15 const char *GetGameStringPtr(uint id);
16 void RegisterGameTranslation(class Squirrel *engine);
18 
21  const char *language;
23 
24  LanguageStrings(const char *language, const char *end = nullptr);
26 };
27 
29 struct GameStrings {
30  uint version;
31  std::shared_ptr<LanguageStrings> cur_language;
32 
33  std::vector<std::unique_ptr<LanguageStrings>> raw_strings;
34  std::vector<std::shared_ptr<LanguageStrings>> compiled_strings;
36 
37  void Compile();
38 };
39 
40 #endif /* GAME_TEXT_HPP */
std::vector< std::shared_ptr< LanguageStrings > > compiled_strings
The compiled strings per language, first must be English/the master language!.
Definition: game_text.hpp:34
LanguageStrings(const char *language, const char *end=nullptr)
Create a new container for language strings.
Definition: game_text.cpp:66
const char * GetGameStringPtr(uint id)
Get the string pointer of a particular game string.
Definition: game_text.cpp:335
Container for all the game strings.
Definition: game_text.hpp:29
void RegisterGameTranslation(class Squirrel *engine)
Register the current translation to the Squirrel engine.
Definition: game_text.cpp:345
uint version
The version of the language strings.
Definition: game_text.hpp:30
Container for the raw (unencoded) language strings of a language.
Definition: game_text.hpp:20
StringList lines
The lines of the file to pass into the parser/encoder.
Definition: game_text.hpp:22
std::shared_ptr< LanguageStrings > cur_language
The current (compiled) language.
Definition: game_text.hpp:31
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:58
void ReconsiderGameScriptLanguage()
Reconsider the game script language, so we use the right one.
Definition: game_text.cpp:372
~LanguageStrings()
Free everything.
Definition: game_text.cpp:72
std::vector< std::unique_ptr< LanguageStrings > > raw_strings
The raw strings per language, first must be English/the master language!.
Definition: game_text.hpp:33
const char * language
Name of the language (base filename).
Definition: game_text.hpp:21
StringList string_names
The names of the compiled strings.
Definition: game_text.hpp:35