Codechange: use std::string_view to parse setting values

This commit is contained in:
Rubidium
2025-04-21 22:21:52 +02:00
committed by rubidium42
parent 12118b201c
commit fdb8defa64
4 changed files with 57 additions and 61 deletions

View File

@@ -445,11 +445,11 @@ static bool CheckRoadSide(int32_t &)
* @param value that was read from config file
* @return the "hopefully" converted value
*/
static size_t ConvertLandscape(const char *value)
static std::optional<uint32_t> ConvertLandscape(std::string_view value)
{
/* try with the old values */
static std::vector<std::string> _old_landscape_values{"normal", "hilly", "desert", "candy"};
return OneOfManySettingDesc::ParseSingleValue(value, strlen(value), _old_landscape_values);
return OneOfManySettingDesc::ParseSingleValue(value, _old_landscape_values);
}
static bool CheckFreeformEdges(int32_t &new_value)