Merge branch 'master' into jgrpp
# Conflicts: # src/autoreplace_gui.cpp # src/build_vehicle_gui.cpp # src/cheat_gui.cpp # src/company_gui.cpp # src/debug.cpp # src/engine_gui.h # src/error_gui.cpp # src/group_gui.cpp # src/industry_cmd.cpp # src/industry_gui.cpp # src/misc_gui.cpp # src/network/network_gui.cpp # src/newgrf.cpp # src/newgrf_debug_gui.cpp # src/newgrf_gui.cpp # src/order_gui.cpp # src/rail_gui.cpp # src/road_gui.cpp # src/saveload/saveload.cpp # src/screenshot_gui.cpp # src/sound/win32_s.cpp # src/statusbar_gui.cpp # src/strgen/strgen.cpp # src/table/newgrf_debug_data.h # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_gui.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/viewport.cpp
This commit is contained in:
@@ -240,12 +240,12 @@ struct UnmappedChoiceList {
|
||||
* @param byte80 The control code to use as replacement for the 0x80-value.
|
||||
* @return The translated string.
|
||||
*/
|
||||
std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool allow_newlines, const std::string &str, StringControlCode byte80)
|
||||
std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool allow_newlines, std::string_view str, StringControlCode byte80)
|
||||
{
|
||||
/* Empty input string? Nothing to do here. */
|
||||
if (str.empty()) return str;
|
||||
if (str.empty()) return {};
|
||||
|
||||
std::string::const_iterator src = str.cbegin();
|
||||
std::string_view::const_iterator src = str.cbegin();
|
||||
|
||||
/* Is this an unicode string? */
|
||||
bool unicode = false;
|
||||
@@ -494,7 +494,7 @@ string_end:
|
||||
* @param langid The The language of the new text.
|
||||
* @param text_to_add The text to add to the list.
|
||||
*/
|
||||
static void AddGRFTextToList(GRFTextList &list, uint8_t langid, const std::string &text_to_add)
|
||||
static void AddGRFTextToList(GRFTextList &list, uint8_t langid, std::string_view text_to_add)
|
||||
{
|
||||
/* Loop through all languages and see if we can replace a string */
|
||||
for (auto &text : list) {
|
||||
@@ -505,7 +505,7 @@ static void AddGRFTextToList(GRFTextList &list, uint8_t langid, const std::strin
|
||||
}
|
||||
|
||||
/* If a string wasn't replaced, then we must append the new string */
|
||||
list.push_back(GRFText{ langid, text_to_add });
|
||||
list.push_back(GRFText{ langid, std::string(text_to_add) });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -517,7 +517,7 @@ static void AddGRFTextToList(GRFTextList &list, uint8_t langid, const std::strin
|
||||
* @param text_to_add The text to add to the list.
|
||||
* @note All text-codes will be translated.
|
||||
*/
|
||||
void AddGRFTextToList(GRFTextList &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add)
|
||||
void AddGRFTextToList(GRFTextList &list, uint8_t langid, uint32_t grfid, bool allow_newlines, std::string_view text_to_add)
|
||||
{
|
||||
AddGRFTextToList(list, langid, TranslateTTDPatchCodes(grfid, langid, allow_newlines, text_to_add));
|
||||
}
|
||||
@@ -531,7 +531,7 @@ void AddGRFTextToList(GRFTextList &list, uint8_t langid, uint32_t grfid, bool al
|
||||
* @param text_to_add The text to add to the list.
|
||||
* @note All text-codes will be translated.
|
||||
*/
|
||||
void AddGRFTextToList(GRFTextWrapper &list, uint8_t langid, uint32_t grfid, bool allow_newlines, const char *text_to_add)
|
||||
void AddGRFTextToList(GRFTextWrapper &list, uint8_t langid, uint32_t grfid, bool allow_newlines, std::string_view text_to_add)
|
||||
{
|
||||
if (!list) list.reset(new GRFTextList());
|
||||
AddGRFTextToList(*list, langid, grfid, allow_newlines, text_to_add);
|
||||
@@ -543,7 +543,7 @@ void AddGRFTextToList(GRFTextWrapper &list, uint8_t langid, uint32_t grfid, bool
|
||||
* @param list The list where the text should be added to.
|
||||
* @param text_to_add The text to add to the list.
|
||||
*/
|
||||
void AddGRFTextToList(GRFTextWrapper &list, const std::string &text_to_add)
|
||||
void AddGRFTextToList(GRFTextWrapper &list, std::string_view text_to_add)
|
||||
{
|
||||
if (!list) list.reset(new GRFTextList());
|
||||
AddGRFTextToList(*list, GRFLX_UNSPECIFIED, text_to_add);
|
||||
@@ -552,7 +552,7 @@ void AddGRFTextToList(GRFTextWrapper &list, const std::string &text_to_add)
|
||||
/**
|
||||
* Add the new read string into our structure.
|
||||
*/
|
||||
StringID AddGRFString(uint32_t grfid, uint16_t stringid, uint8_t langid_to_add, bool new_scheme, bool allow_newlines, const char *text_to_add, StringID def_string)
|
||||
StringID AddGRFString(uint32_t grfid, uint16_t stringid, uint8_t langid_to_add, bool new_scheme, bool allow_newlines, std::string_view text_to_add, StringID def_string)
|
||||
{
|
||||
/* When working with the old language scheme (grf_version is less than 7) and
|
||||
* English or American is among the set bits, simply add it as English in
|
||||
|
Reference in New Issue
Block a user