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/>.
8 /** @file newgrf_text.h Header of Action 04 "universal holder" structure and functions */
13 #include "newgrf_text_type.h"
14 #include "strings_type.h"
15 #include "table/control_codes.h"
17 StringID
AddGRFString(uint32_t grfid
, uint16_t stringid
, uint8_t langid
, bool new_scheme
, bool allow_newlines
, std::string_view text_to_add
, StringID def_string
);
18 StringID
GetGRFStringID(uint32_t grfid
, StringID stringid
);
19 const char *GetGRFStringFromGRFText(const GRFTextList
&text_list
);
20 const char *GetGRFStringFromGRFText(const GRFTextWrapper
&text
);
21 const char *GetGRFStringPtr(uint32_t stringid
);
22 void CleanUpStrings();
23 void SetCurrentGrfLangID(uint8_t language_id
);
24 std::string
TranslateTTDPatchCodes(uint32_t grfid
, uint8_t language_id
, bool allow_newlines
, std::string_view str
, StringControlCode byte80
= SCC_NEWGRF_PRINT_WORD_STRING_ID
);
25 void AddGRFTextToList(GRFTextList
&list
, uint8_t langid
, uint32_t grfid
, bool allow_newlines
, std::string_view text_to_add
);
26 void AddGRFTextToList(GRFTextWrapper
&list
, uint8_t langid
, uint32_t grfid
, bool allow_newlines
, std::string_view text_to_add
);
27 void AddGRFTextToList(GRFTextWrapper
&list
, std::string_view text_to_add
);
29 bool CheckGrfLangID(uint8_t lang_id
, uint8_t grf_version
);
31 void StartTextRefStackUsage(const struct GRFFile
*grffile
, uint8_t numEntries
, const uint32_t *values
= nullptr);
32 void StopTextRefStackUsage();
33 bool UsingNewGRFTextStack();
34 struct TextRefStack
*CreateTextRefStackBackup();
35 void RestoreTextRefStackBackup(struct TextRefStack
*backup
);
37 #endif /* NEWGRF_TEXT_H */