Merge branch 'openttd'

This commit is contained in:
dP
2025-09-01 23:28:07 +05:00
900 changed files with 37552 additions and 26733 deletions
+12 -3
View File
@@ -447,11 +447,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);
static constexpr std::initializer_list<std::string_view> _old_landscape_values{"normal"sv, "hilly"sv, "desert"sv, "candy"sv};
return OneOfManySettingDesc::ParseSingleValue(value, _old_landscape_values);
}
static bool CheckFreeformEdges(int32_t &new_value)
@@ -669,6 +669,15 @@ static void ChangeMinutesPerYear(int32_t new_value)
}
}
/* Get the valid range of the "minutes per calendar year" setting. */
static std::tuple<int32_t, uint32_t> GetMinutesPerYearRange(const IntSettingDesc &)
{
/* Allow a non-default value only if using Wallclock timekeeping units. */
if (_settings_newgame.economy.timekeeping_units == TKU_WALLCLOCK) return { CalendarTime::FROZEN_MINUTES_PER_YEAR, CalendarTime::MAX_MINUTES_PER_YEAR };
return { CalendarTime::DEF_MINUTES_PER_YEAR, CalendarTime::DEF_MINUTES_PER_YEAR };
}
/**
* Pre-callback check when trying to change the timetable mode. This is locked to Seconds when using wallclock units.
* @param Unused.