1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Merge pull request #24666 from Gymnasiast/fix/24661

Fix #24661: convert console command always crashes with a segmentation fault
This commit is contained in:
Michael Steenbeek
2025-06-24 14:00:17 +02:00
committed by GitHub
3 changed files with 10 additions and 6 deletions

View File

@@ -22,6 +22,8 @@
- Fix: [#24615] Blank strings in Windows installer.
- Fix: [#24617] Divide by zero error when updating boat hire acceleration.
- Fix: [#24626] Viewports that only follow sprites (e.g. in the Ride and Guest windows) can be made to unfollow them.
- Fix: [#24661] `convert` console command always crashes with a segmentation fault.
- Fix: [#24666] `convert` console command rejects files with an SV7 extension.
0.4.23 (2025-06-07)
------------------------------------------------------------------------

View File

@@ -183,21 +183,23 @@ namespace OpenRCT2
const auto mainWindow = WindowGetMain();
const auto mainViewport = WindowGetViewport(mainWindow);
CoordsXYZ mapPosXYZ{};
CoordsXYZD mapPosXYZD{};
if (mainViewport != nullptr)
{
const auto centre = mainViewport->viewPos
+ ScreenCoordsXY{ mainViewport->ViewWidth() / 2, mainViewport->ViewHeight() / 2 };
const auto mapPos = ViewportPosToMapPos(centre, 24, mainViewport->rotation);
mapPosXYZ = CoordsXYZ(mapPos.x, mapPos.y, int32_t{ TileElementHeight(mapPos) });
mapPosXYZD = CoordsXYZD(mapPos.x, mapPos.y, int32_t{ TileElementHeight(mapPos) }, mainViewport->rotation);
}
else if (!gameState.park.Entrances.empty())
{
const auto& entrance = gameState.park.Entrances[0];
mapPosXYZ = CoordsXYZ{ entrance.x + 16, entrance.y + 16, entrance.z + 32 };
mapPosXYZD = CoordsXYZD(entrance.x + 16, entrance.y + 16, entrance.z + 32, DirectionReverse(entrance.direction));
}
else
{
return std::nullopt;
}
PreviewImage image{
.type = PreviewImageType::screenshot,
@@ -210,10 +212,10 @@ namespace OpenRCT2
.height = image.height,
.flags = 0,
.zoom = ZoomLevel{ 1 },
.rotation = mainViewport->rotation,
.rotation = mapPosXYZD.direction,
};
auto viewPos = centre_2d_coordinates(mapPosXYZ, &saveVp);
auto viewPos = centre_2d_coordinates(mapPosXYZD, &saveVp);
if (viewPos == std::nullopt)
return std::nullopt;

View File

@@ -128,7 +128,7 @@ namespace OpenRCT2::RCT2
{
return LoadScenario(path, skipObjectCheck);
}
if (String::iequals(extension, ".sv6"))
if (String::iequals(extension, ".sv6") || String::iequals(extension, ".sv7"))
{
return LoadSavedGame(path, skipObjectCheck);
}