1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 03:12:41 +01:00

Codechange: use const for std::string_view where appropriate

This commit is contained in:
Rubidium
2025-04-29 07:10:48 +02:00
committed by rubidium42
parent 78250c3bba
commit af25eecc15
34 changed files with 87 additions and 87 deletions

View File

@@ -88,7 +88,7 @@ int ScriptConfig::GetSetting(const std::string &name) const
return (*it).second;
}
void ScriptConfig::SetSetting(const std::string_view name, int value)
void ScriptConfig::SetSetting(std::string_view name, int value)
{
/* You can only set Script specific settings if an Script is selected. */
if (this->info == nullptr) return;

View File

@@ -122,7 +122,7 @@ public:
/**
* Set the value of a setting for this config.
*/
void SetSetting(const std::string_view name, int value);
void SetSetting(std::string_view name, int value);
/**
* Reset all settings to their default value.

View File

@@ -38,7 +38,7 @@ bool ScriptInfo::CheckMethod(std::string_view name) const
info.engine = info.scanner->GetEngine();
/* Ensure the mandatory functions exist */
static std::string_view const required_functions[] = {
static const std::string_view required_functions[] = {
"GetAuthor",
"GetName",
"GetShortName",
@@ -253,7 +253,7 @@ const ScriptConfigItemList *ScriptInfo::GetConfigList() const
return &this->config_list;
}
const ScriptConfigItem *ScriptInfo::GetConfigItem(const std::string_view name) const
const ScriptConfigItem *ScriptInfo::GetConfigItem(std::string_view name) const
{
for (const auto &item : this->config_list) {
if (item.name == name) return &item;

View File

@@ -107,7 +107,7 @@ public:
/**
* Get the description of a certain Script config option.
*/
const ScriptConfigItem *GetConfigItem(const std::string_view name) const;
const ScriptConfigItem *GetConfigItem(std::string_view name) const;
/**
* Set a setting.

View File

@@ -238,7 +238,7 @@ public:
/**
* Throw a Squirrel error that will be nicely displayed to the user.
*/
void ThrowError(const std::string_view error) { sq_throwerror(this->vm, error); }
void ThrowError(std::string_view error) { sq_throwerror(this->vm, error); }
/**
* Release a SQ object.