diff --git a/ActiveObject.h b/ActiveObject.h index 6385748..47725eb 100644 --- a/ActiveObject.h +++ b/ActiveObject.h @@ -18,4 +18,38 @@ struct ActiveObject { bool highlighted = false; }; -} \ No newline at end of file +class ActiveObjectManager { + public: + // Добавить или обновить объект в контейнере + void addActiveObject(const ActiveObject& object) { + activeObjects[object.name] = object; + } + + // Найти объект по имени (возвращает указатель, nullptr — если не найден) + ActiveObject* findByName(const std::string& name) { + auto it = activeObjects.find(name); + if (it != activeObjects.end()) { + return &it->second; + } + return nullptr; + } + + // Найти все объекты с нужным значением highlighted + // (возвращает список указателей на найденные объекты) + std::vector findByHighlighted(bool highlighted) { + std::vector result; + result.reserve(activeObjects.size()); + for (auto& [key, object] : activeObjects) { + if (object.highlighted == highlighted) { + result.push_back(&object); + } + } + return result; + } + + private: + // Хранение объектов по ключу name + std::unordered_map activeObjects; + }; + +} diff --git a/GameObjectManager.cpp b/GameObjectManager.cpp index 18e0208..8a15277 100644 --- a/GameObjectManager.cpp +++ b/GameObjectManager.cpp @@ -56,7 +56,7 @@ void GameObjectManager::initialize() { Room room_1; room_1.roomTexture = std::make_shared(CreateTextureDataFromBmp24("./Kitchen_ceramics.bmp")); room_1.objects.push_back(ao1); - room_1.sound_name = "file_example_OOG_5MG.ogg"; + room_1.sound_name = "Symphony No.6 (1st movement).ogg"; room_1.roomLogic = createRoom1Logic(); rooms.push_back(room_1);