mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Remove local instances of std::optional
This commit is contained in:
@@ -139,7 +139,6 @@ namespace OpenRCT2::Scripting
|
||||
private:
|
||||
static std::optional<CoordsXY> GetCoordsXY(const DukValue& dukCoords)
|
||||
{
|
||||
std::optional<CoordsXY> result;
|
||||
if (dukCoords.type() == DukValue::Type::OBJECT)
|
||||
{
|
||||
auto dukX = dukCoords["x"];
|
||||
@@ -148,16 +147,15 @@ namespace OpenRCT2::Scripting
|
||||
auto dukY = dukCoords["y"];
|
||||
if (dukY.type() == DukValue::Type::NUMBER)
|
||||
{
|
||||
result = { dukX.as_int(), dukY.as_int() };
|
||||
return CoordsXY(dukX.as_int(), dukY.as_int());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::optional<MapRange> GetMapRange(const DukValue& dukMapRange)
|
||||
{
|
||||
std::optional<MapRange> result;
|
||||
if (dukMapRange.type() == DukValue::Type::OBJECT)
|
||||
{
|
||||
auto leftTop = GetCoordsXY(dukMapRange["leftTop"]);
|
||||
@@ -166,11 +164,11 @@ namespace OpenRCT2::Scripting
|
||||
auto rightBottom = GetCoordsXY(dukMapRange["rightBottom"]);
|
||||
if (rightBottom.has_value())
|
||||
{
|
||||
result = MapRange(leftTop->x, leftTop->y, rightBottom->x, rightBottom->y);
|
||||
return MapRange(leftTop->x, leftTop->y, rightBottom->x, rightBottom->y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
} // namespace OpenRCT2::Scripting
|
||||
|
||||
Reference in New Issue
Block a user