mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-01 03:05:24 +01:00
remove all unnecessary object resets
This commit is contained in:
@@ -370,7 +370,6 @@ static int editor_read_s6(const char *path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
reset_loaded_objects();
|
||||
map_update_tile_pointers();
|
||||
game_convert_strings_to_utf8();
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#pragma endregion
|
||||
|
||||
#include <stack>
|
||||
#include "../object/ObjectManager.h"
|
||||
#include "LanguagePack.h"
|
||||
|
||||
extern "C" {
|
||||
@@ -189,13 +190,12 @@ bool language_open(int id)
|
||||
gCurrentTTFFontSet = &TTFFontCustom;
|
||||
|
||||
bool font_initialised = ttf_initialise();
|
||||
if(!font_initialised) {
|
||||
if (!font_initialised) {
|
||||
log_warning("Unable to initialise configured TrueType font -- falling back to Language default.");
|
||||
} else {
|
||||
// Objects and their localized strings need to be refreshed
|
||||
reset_loaded_objects();
|
||||
|
||||
return 1;
|
||||
GetObjectManager()->ResetObjects();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ttf_dispose();
|
||||
@@ -220,8 +220,7 @@ bool language_open(int id)
|
||||
}
|
||||
|
||||
// Objects and their localized strings need to be refreshed
|
||||
reset_loaded_objects();
|
||||
|
||||
GetObjectManager()->ResetObjects();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ bool object_saved_packed(SDL_RWops* rw, const rct_object_entry * entry);
|
||||
int check_object_entry(const rct_object_entry *entry);
|
||||
bool object_entry_compare(const rct_object_entry *a, const rct_object_entry *b);
|
||||
int object_calculate_checksum(const rct_object_entry * entry, const void * data, size_t dataLength);
|
||||
void reset_loaded_objects();
|
||||
int find_object_in_entry_group(const rct_object_entry* entry, uint8* entry_type, uint8* entry_index);
|
||||
void object_create_identifier_name(char* string_buffer, const rct_object_entry* object);
|
||||
|
||||
|
||||
@@ -180,6 +180,22 @@ public:
|
||||
reset_type_to_ride_entry_index_map();
|
||||
}
|
||||
|
||||
void ResetObjects() override
|
||||
{
|
||||
if (_loadedObjects != nullptr)
|
||||
{
|
||||
for (size_t i = 0; i < OBJECT_ENTRY_COUNT; i++)
|
||||
{
|
||||
Object * loadedObject = _loadedObjects[i];
|
||||
if (loadedObject != nullptr)
|
||||
{
|
||||
loadedObject->Unload();
|
||||
loadedObject->Load();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
sint32 FindSpareSlot(uint8 objectType)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,8 @@ interface IObjectManager
|
||||
virtual bool LoadObjects(const rct_object_entry * entries, size_t count) abstract;
|
||||
virtual void UnloadObjects(const rct_object_entry * entries, size_t count) abstract;
|
||||
virtual void UnloadAll() abstract;
|
||||
|
||||
virtual void ResetObjects() abstract;
|
||||
};
|
||||
|
||||
IObjectManager * GetObjectManager();
|
||||
|
||||
@@ -634,24 +634,6 @@ extern "C"
|
||||
return true;
|
||||
}
|
||||
|
||||
void reset_loaded_objects()
|
||||
{
|
||||
// if (_loadedObjects != nullptr)
|
||||
// {
|
||||
// for (int i = 0; i < OBJECT_ENTRY_COUNT; i++)
|
||||
// {
|
||||
// Object * object = _loadedObjects[i];
|
||||
// if (object != nullptr)
|
||||
// {
|
||||
// object->Unload();
|
||||
// object->Load();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// reset_type_to_ride_entry_index_map();
|
||||
}
|
||||
|
||||
void * object_repository_load_object(const rct_object_entry * objectEntry)
|
||||
{
|
||||
Object * object = nullptr;
|
||||
|
||||
@@ -736,8 +736,6 @@ void S4Importer::LoadObjects()
|
||||
}));
|
||||
LoadObjects(OBJECT_TYPE_PARK_ENTRANCE, List<const char *>({ "PKENT1 " }));
|
||||
LoadObjects(OBJECT_TYPE_WATER, List<const char *>({ "WTRCYAN " }));
|
||||
|
||||
reset_loaded_objects();
|
||||
}
|
||||
|
||||
void S4Importer::LoadObjects(uint8 objectType, List<const char *> entries)
|
||||
|
||||
@@ -507,7 +507,6 @@ extern "C"
|
||||
}
|
||||
delete s6exporter;
|
||||
|
||||
reset_loaded_objects();
|
||||
gfx_invalidate_screen();
|
||||
|
||||
if (result && !(flags & S6_SAVE_FLAG_AUTOMATIC))
|
||||
@@ -540,8 +539,6 @@ extern "C"
|
||||
return 0;
|
||||
}
|
||||
|
||||
reset_loaded_objects();
|
||||
|
||||
// Write other data not in normal save files
|
||||
SDL_WriteLE32(rw, gGamePaused);
|
||||
SDL_WriteLE32(rw, _guestGenerationProbability);
|
||||
|
||||
@@ -362,7 +362,6 @@ void S6Importer::Import()
|
||||
{
|
||||
throw ObjectLoadException();
|
||||
}
|
||||
reset_loaded_objects();
|
||||
map_update_tile_pointers();
|
||||
if (network_get_mode() == NETWORK_MODE_CLIENT)
|
||||
{
|
||||
|
||||
@@ -732,7 +732,6 @@ static void window_editor_object_selection_close(rct_window *w)
|
||||
|
||||
unload_unselected_objects();
|
||||
editor_load_selected_objects();
|
||||
reset_loaded_objects();
|
||||
editor_object_flags_free();
|
||||
|
||||
object_delete(_loadedObject);
|
||||
|
||||
Reference in New Issue
Block a user