mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
When you try to mirror a track design that has a path object type that isn't loaded it will try to pass an uninitialised variable as the index of the path object. This will cause a bad pointer to be generated. Fix was to auto set it to zero and to be super careful reset it again to zero in the case when its not available
This commit is contained in:
@@ -494,7 +494,7 @@ static void track_design_mirror_scenery(rct_track_td6* td6)
|
||||
rct_td6_scenery_element* scenery = td6->scenery_elements;
|
||||
for (; scenery != nullptr && scenery->scenery_object.end_flag != 0xFF; scenery++)
|
||||
{
|
||||
uint8_t entry_type, entry_index;
|
||||
uint8_t entry_type{ 0 }, entry_index{ 0 };
|
||||
if (!find_object_in_entry_group(&scenery->scenery_object, &entry_type, &entry_index))
|
||||
{
|
||||
entry_type = object_entry_get_type(&scenery->scenery_object);
|
||||
@@ -502,6 +502,8 @@ static void track_design_mirror_scenery(rct_track_td6* td6)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
entry_index = 0;
|
||||
}
|
||||
|
||||
rct_scenery_entry* scenery_entry = (rct_scenery_entry*)object_entry_get_chunk(entry_type, entry_index);
|
||||
|
||||
Reference in New Issue
Block a user