mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-19 10:22:39 +01:00
Codechange: make start-ai console command parsing work with std::string_view
This commit is contained in:
@@ -20,10 +20,10 @@
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
void ScriptConfig::Change(std::optional<std::string> name, int version, bool force_exact_match)
|
||||
void ScriptConfig::Change(std::optional<std::string_view> name, int version, bool force_exact_match)
|
||||
{
|
||||
if (name.has_value()) {
|
||||
this->name = std::move(name.value());
|
||||
this->name = name.value();
|
||||
this->info = this->FindInfo(this->name, version, force_exact_match);
|
||||
} else {
|
||||
this->info = nullptr;
|
||||
@@ -140,7 +140,7 @@ int ScriptConfig::GetVersion() const
|
||||
return this->version;
|
||||
}
|
||||
|
||||
void ScriptConfig::StringToSettings(const std::string &value)
|
||||
void ScriptConfig::StringToSettings(std::string_view value)
|
||||
{
|
||||
std::string_view to_process = value;
|
||||
for (;;) {
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
* @param force_exact_match If true try to find the exact same version
|
||||
* as specified. If false any compatible version is ok.
|
||||
*/
|
||||
void Change(std::optional<std::string> name, int version = -1, bool force_exact_match = false);
|
||||
void Change(std::optional<std::string_view> name, int version = -1, bool force_exact_match = false);
|
||||
|
||||
/**
|
||||
* Get the ScriptInfo linked to this ScriptConfig.
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* Convert a string which is stored in the config file or savegames to
|
||||
* custom settings of this Script.
|
||||
*/
|
||||
void StringToSettings(const std::string &value);
|
||||
void StringToSettings(std::string_view value);
|
||||
|
||||
/**
|
||||
* Convert the custom settings to a string that can be stored in the config
|
||||
|
||||
Reference in New Issue
Block a user