1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Make string to v3f parsing consistent, replace core.setting_get_pos() by core.settings:get_pos() (#15438)

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
This commit is contained in:
AFCMS 2024-12-04 18:19:46 +01:00 committed by GitHub
parent 18caf3a18d
commit e545e96d2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 162 additions and 45 deletions

View file

@ -541,7 +541,7 @@ v2f Settings::getV2F(const std::string &name) const
}
v3f Settings::getV3F(const std::string &name) const
std::optional<v3f> Settings::getV3F(const std::string &name) const
{
return str_to_v3f(get(name));
}
@ -626,7 +626,11 @@ bool Settings::getNoiseParamsFromGroup(const std::string &name,
group->getFloatNoEx("offset", np.offset);
group->getFloatNoEx("scale", np.scale);
group->getV3FNoEx("spread", np.spread);
std::optional<v3f> spread;
if (group->getV3FNoEx("spread", spread) && spread.has_value())
np.spread = *spread;
group->getS32NoEx("seed", np.seed);
group->getU16NoEx("octaves", np.octaves);
group->getFloatNoEx("persistence", np.persist);
@ -783,7 +787,7 @@ bool Settings::getV2FNoEx(const std::string &name, v2f &val) const
}
bool Settings::getV3FNoEx(const std::string &name, v3f &val) const
bool Settings::getV3FNoEx(const std::string &name, std::optional<v3f> &val) const
{
try {
val = getV3F(name);