Fix #1834 & #2288. Non complete circuit tracks now save correctly.

Issue was caused by a bit of code not iterating correctly backwards.
This commit is contained in:
duncanspumpkin 2015-11-11 19:44:53 +00:00
parent 47ca2c4c59
commit 6a00482d1f
2 changed files with 11 additions and 3 deletions

View File

@ -368,7 +368,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<PreprocessorDefinitions>DEBUG;DEBUG_DESYNC;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ObjectFileName>$(IntDir)fake\%(RelativeDir)</ObjectFileName>

View File

@ -2654,14 +2654,22 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra
}
int z = 0;
//6ce69e
// Find the start of the track.
// It has to do this as a backwards loop incase this is an incomplete track.
if (track_block_get_previous(trackElement.x, trackElement.y, trackElement.element, &trackBeginEnd)) {
rct_map_element* initial_map = trackElement.element;
do {
rct_xy_element lastGood = {
.element = trackBeginEnd.begin_element,
.x = trackBeginEnd.begin_x,
.y = trackBeginEnd.begin_y
};
if (!track_block_get_previous(trackBeginEnd.begin_x, trackBeginEnd.begin_y, trackBeginEnd.begin_element, &trackBeginEnd)) {
trackElement = lastGood;
break;
}
} while (initial_map != trackElement.element);
} while (initial_map != trackBeginEnd.begin_element);
}
z = trackElement.element->base_height * 8;