From dcd7a81432d6244762d69cc0ee7f0393cdd56b84 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 29 Apr 2025 13:38:47 -0400 Subject: [PATCH] Refactor asset loading in EditorManager to iterate over active editors; streamline loading process for better scalability and maintainability. --- src/app/editor/editor_manager.cc | 5 +++-- src/app/editor/editor_manager.h | 8 -------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index d1a0cac5..75f3e2ed 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -551,8 +551,9 @@ absl::Status EditorManager::LoadAssets() { auto &sheet_manager = GraphicsSheetManager::GetInstance(); ASSIGN_OR_RETURN(*sheet_manager.mutable_gfx_sheets(), LoadAllGraphicsData(*current_rom_)); - RETURN_IF_ERROR(current_editor_set_->overworld_editor_.Load()); - RETURN_IF_ERROR(current_editor_set_->dungeon_editor_.Load()); + for (auto &editor : current_editor_set_->active_editors_) { + RETURN_IF_ERROR(editor->Load()); + } return absl::OkStatus(); } diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index 1a22952f..17cf5fb9 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -140,14 +140,6 @@ class EditorSet { MemoryEditorWithDiffChecker memory_editor_; std::vector active_editors_; - - void CleanupUnusedTextures(uint64_t current_time, uint64_t timeout) { - if (active_editors_.size() > 0) { - for (auto editor : active_editors_) { - editor->CleanupUnusedTextures(current_time, timeout); - } - } - } }; } // namespace editor