diff options
author | Rubidium <rubidium@openttd.org> | 2021-06-14 23:17:58 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-06-15 06:13:00 +0200 |
commit | d31a535c87a5dc9f2333ddb00a116109fed68ec8 (patch) | |
tree | 85682898aadd944c71d3c2563182f9a101f44945 | |
parent | 05005dcdfa4f2d0c8fe2e0f0a92103dccd4691ab (diff) | |
download | openttd-d31a535c87a5dc9f2333ddb00a116109fed68ec8.tar.xz |
Cleanup: remove some unneeded c_str() calls
-rw-r--r-- | src/game/game_text.cpp | 2 | ||||
-rw-r--r-- | src/script/script_scanner.cpp | 2 | ||||
-rw-r--r-- | src/settings.cpp | 6 | ||||
-rw-r--r-- | src/vehicle_cmd.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 74e8d63bd..ca102f912 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -231,7 +231,7 @@ GameStrings *LoadTranslations() basename.erase(e + 1); std::string filename = basename + "lang" PATHSEP "english.txt"; - if (!FioCheckFileExists(filename.c_str() , GAME_DIR)) return nullptr; + if (!FioCheckFileExists(filename, GAME_DIR)) return nullptr; auto ls = ReadRawLanguageStrings(filename); if (!ls.IsValid()) return nullptr; diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index dc14da1db..319a1c7fc 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -182,7 +182,7 @@ struct ScriptFileChecksumCreator : FileScanner { byte tmp_md5sum[16]; /* Open the file ... */ - FILE *f = FioFOpenFile(filename.c_str(), "rb", this->dir, &size); + FILE *f = FioFOpenFile(filename, "rb", this->dir, &size); if (f == nullptr) return false; /* ... calculate md5sum... */ diff --git a/src/settings.cpp b/src/settings.cpp index 23f43d24f..54189a0fc 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -708,7 +708,7 @@ static void IniSaveSettingList(IniFile *ini, const char *grpname, StringList &li group->Clear(); for (const auto &iter : list) { - group->GetItem(iter.c_str(), true)->SetValue(""); + group->GetItem(iter, true)->SetValue(""); } } @@ -1272,7 +1272,7 @@ static void AILoadConfig(IniFile *ini, const char *grpname) continue; } } - if (item->value.has_value()) config->StringToSettings(item->value->c_str()); + if (item->value.has_value()) config->StringToSettings(*item->value); } } @@ -1299,7 +1299,7 @@ static void GameLoadConfig(IniFile *ini, const char *grpname) return; } } - if (item->value.has_value()) config->StringToSettings(item->value->c_str()); + if (item->value.has_value()) config->StringToSettings(*item->value); } /** diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 84d339b27..499b3b3eb 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -804,7 +804,7 @@ static void CloneVehicleName(const Vehicle *src, Vehicle *dst) /* Check the name is unique. */ auto new_name = oss.str(); - if (IsUniqueVehicleName(new_name.c_str())) { + if (IsUniqueVehicleName(new_name)) { dst->name = new_name; break; } |