diff --git a/src/saveload/game_sl.cpp b/src/saveload/game_sl.cpp --- a/src/saveload/game_sl.cpp +++ b/src/saveload/game_sl.cpp @@ -129,14 +129,14 @@ static const SaveLoad _game_language_str SLE_END() }; -static void SaveReal_GSTR(LanguageStrings *ls) +static void SaveReal_GSTR(const LanguageStrings *ls) { _game_saveload_string = ls->language; _game_saveload_strings = (uint)ls->lines.size(); SlObject(NULL, _game_language_header); - for (uint i = 0; i < _game_saveload_strings; i++) { - _game_saveload_string = ls->lines[i]; + for (const auto &i : ls->lines) { + _game_saveload_string = i.c_str(); SlObject(NULL, _game_language_string); } } @@ -153,7 +153,7 @@ static void Load_GSTR() std::unique_ptr ls(new LanguageStrings(_game_saveload_string != NULL ? _game_saveload_string : "")); for (uint i = 0; i < _game_saveload_strings; i++) { SlObject(NULL, _game_language_string); - ls->lines.push_back(stredup(_game_saveload_string != NULL ? _game_saveload_string : "")); + ls->lines.emplace_back(_game_saveload_string != NULL ? _game_saveload_string : ""); } _current_data->raw_strings.push_back(std::move(ls));