1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 12:33:17 +01:00

fix #3562: loaded objects are not unloaded when loading a new game

This commit is contained in:
Ted John
2016-05-14 12:54:55 +01:00
parent f62932a5d3
commit d0d2ad7ded
2 changed files with 3 additions and 2 deletions

View File

@@ -398,6 +398,7 @@ void object_unload_chunk(rct_object_entry *entry)
object_unload(object_type, chunk);
free(chunk);
memset(&object_entry_groups[object_type].entries[object_index], 0, sizeof(rct_object_entry_extended));
object_entry_groups[object_type].chunks[object_index] = (uint8*)-1;
}

View File

@@ -541,8 +541,6 @@ void set_load_objects_fail_reason()
*/
bool object_read_and_load_entries(SDL_RWops* rw)
{
object_unload_all();
// Read all the object entries
rct_object_entry *entries = malloc(OBJECT_ENTRY_COUNT * sizeof(rct_object_entry));
sawyercoding_read_chunk(rw, (uint8*)entries);
@@ -555,6 +553,8 @@ bool object_load_entries(rct_object_entry* entries)
{
log_verbose("loading required objects");
object_unload_all();
bool loadFailed = false;
// Load each object
for (int i = 0; i < OBJECT_ENTRY_COUNT; i++) {