mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Remove c_str, if std::string_view is already accepted.
parent
b564fbb5e6
commit
36ce1f890a
|
@ -96,7 +96,7 @@ struct StringListReader : StringReader {
|
|||
* @param translation Are we reading a translation?
|
||||
*/
|
||||
StringListReader(StringData &data, const LanguageStrings &strings, bool master, bool translation) :
|
||||
StringReader(data, strings.language.c_str(), master, translation), p(strings.lines.begin()), end(strings.lines.end())
|
||||
StringReader(data, strings.language, master, translation), p(strings.lines.begin()), end(strings.lines.end())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1000,7 +1000,7 @@ static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode)
|
|||
|
||||
if (mode == GLWM_HEIGHTMAP) {
|
||||
/* If the function returns negative, it means there was a problem loading the heightmap */
|
||||
if (!GetHeightmapDimensions(_file_to_saveload.ftype.detailed, _file_to_saveload.name.c_str(), &x, &y)) return;
|
||||
if (!GetHeightmapDimensions(_file_to_saveload.ftype.detailed, _file_to_saveload.name, &x, &y)) return;
|
||||
}
|
||||
|
||||
WindowDesc &desc = (mode == GLWM_HEIGHTMAP) ? _heightmap_load_desc : _generate_landscape_desc;
|
||||
|
|
|
@ -1540,7 +1540,7 @@ bool GenerateLandscape(uint8_t mode)
|
|||
|
||||
if (mode == GWM_HEIGHTMAP) {
|
||||
SetGeneratingWorldProgress(GWP_LANDSCAPE, steps + GLS_HEIGHTMAP);
|
||||
if (!LoadHeightmap(_file_to_saveload.ftype.detailed, _file_to_saveload.name.c_str())) {
|
||||
if (!LoadHeightmap(_file_to_saveload.ftype.detailed, _file_to_saveload.name)) {
|
||||
return false;
|
||||
}
|
||||
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
|
||||
|
|
|
@ -718,7 +718,7 @@ NetworkGame *NetworkAddServer(std::string_view connection_string, bool manually,
|
|||
void GetBindAddresses(NetworkAddressList *addresses, uint16_t port)
|
||||
{
|
||||
for (const auto &iter : _network_bind_list) {
|
||||
addresses->emplace_back(iter.c_str(), port);
|
||||
addresses->emplace_back(iter, port);
|
||||
}
|
||||
|
||||
/* No address, so bind to everything. */
|
||||
|
|
|
@ -1155,7 +1155,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||
this->preset = index;
|
||||
|
||||
if (index != -1) {
|
||||
this->actives = LoadGRFPresetFromConfig(this->grf_presets[index].c_str());
|
||||
this->actives = LoadGRFPresetFromConfig(this->grf_presets[index]);
|
||||
}
|
||||
this->avails.ForceRebuild();
|
||||
|
||||
|
@ -1170,7 +1170,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||
{
|
||||
if (!str.has_value()) return;
|
||||
|
||||
SaveGRFPresetToConfig(str->c_str(), this->actives);
|
||||
SaveGRFPresetToConfig(*str, this->actives);
|
||||
this->grf_presets = GetGRFPresetList();
|
||||
|
||||
/* Switch to this preset */
|
||||
|
|
|
@ -1186,7 +1186,7 @@ void SwitchToMode(SwitchMode new_mode)
|
|||
break;
|
||||
|
||||
case SM_SAVE_HEIGHTMAP: // Save heightmap.
|
||||
MakeHeightmapScreenshot(_file_to_saveload.name.c_str());
|
||||
MakeHeightmapScreenshot(_file_to_saveload.name);
|
||||
CloseWindowById(WC_SAVELOAD, 0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1125,7 +1125,7 @@ static GRFConfigList GRFLoadConfig(const IniFile &ini, std::string_view grpname,
|
|||
}
|
||||
|
||||
ShowErrorMessage(GetEncodedString(STR_CONFIG_ERROR),
|
||||
GetEncodedString(STR_CONFIG_ERROR_INVALID_GRF, filename.empty() ? item.name.c_str() : filename, reason),
|
||||
GetEncodedString(STR_CONFIG_ERROR_INVALID_GRF, filename.empty() ? item.name : filename, reason),
|
||||
WL_CRITICAL);
|
||||
continue;
|
||||
}
|
||||
|
@ -1559,7 +1559,7 @@ GRFConfigList LoadGRFPresetFromConfig(std::string_view config_name)
|
|||
section += config_name;
|
||||
|
||||
ConfigIniFile ini(_config_file);
|
||||
GRFConfigList config = GRFLoadConfig(ini, section.c_str(), false);
|
||||
GRFConfigList config = GRFLoadConfig(ini, section, false);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
@ -1576,7 +1576,7 @@ void SaveGRFPresetToConfig(std::string_view config_name, GRFConfigList &config)
|
|||
section += config_name;
|
||||
|
||||
ConfigIniFile ini(_config_file);
|
||||
GRFSaveConfig(ini, section.c_str(), config);
|
||||
GRFSaveConfig(ini, section, config);
|
||||
ini.SaveToDisk(_config_file);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue