1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Merge pull request #9889 from duncanspumpkin/fix_9885

Fix track design crashes
This commit is contained in:
Duncan
2019-08-17 11:59:55 +01:00
committed by GitHub
2 changed files with 15 additions and 2 deletions

View File

@@ -33,8 +33,16 @@ T6Exporter::T6Exporter(TrackDesign* trackDesign)
bool T6Exporter::SaveTrack(const utf8* path)
{
auto fs = FileStream(path, FILE_MODE_WRITE);
return SaveTrack(&fs);
try
{
auto fs = FileStream(path, FILE_MODE_WRITE);
return SaveTrack(&fs);
}
catch (const std::exception& e)
{
log_error("Unable to save track design: %s", e.what());
return false;
}
}
bool T6Exporter::SaveTrack(IStream* stream)

View File

@@ -1648,6 +1648,11 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1
TileElement* tile_element = map_get_first_element_at(tile.x >> 5, tile.y >> 5);
z = gTrackPreviewOrigin.z / 8;
z += (entrance.z == (int8_t)(uint8_t)0x80) ? -1 : entrance.z;
if (tile_element == nullptr)
{
_trackDesignPlaceCost = MONEY32_UNDEFINED;
return false;
}
do
{