diff --git a/src/animationsystem.cpp b/src/animationsystem.cpp index d057391..aaf1ebb 100644 --- a/src/animationsystem.cpp +++ b/src/animationsystem.cpp @@ -26,7 +26,7 @@ Cinematic* AnimationSystem::loadCinematic(const std::string& path) { shot->end = shotObject["end"]; shot->world = shotObject["world"]; - for(auto entityObject : shotObject["entities"]) { + for(const auto& entityObject : shotObject["entities"]) { CinematicEntity entity; entity.data = entityObject; @@ -147,7 +147,7 @@ void AnimationSystem::update(Cinematic* cinematic, float deltaTime) { void AnimationSystem::preloadShot(Shot* shot) { worldManager.loadWorld(shot->world); - for(auto cimEntity : shot->entities) { + for(const auto& cimEntity : shot->entities) { EntityID entity = parseEntity(cimEntity.data, worldManager.getWorld(shot->world)); for(auto animation : shot->animations) { @@ -164,8 +164,6 @@ void AnimationSystem::loadShot(Shot* shot) { } void AnimationSystem::unloadShot(Shot* shot) { - World* world = worldManager.getCurrentWorld(); - for(auto entity : shot->loadedEntities) ECS::destroyEntity(entity); } diff --git a/src/config.cpp b/src/config.cpp index fb2b374..307df39 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -33,10 +33,10 @@ void Config::save(const char* to) { return; std::string currentCategory; - for(auto itr : categories) { + for(const auto& itr : categories) { file << "[" << itr.first << "]\n"; - for(auto itr2 : itr.second) { + for(const auto& itr2 : itr.second) { file << itr2.first << "=" << itr2.second << "\n"; } diff --git a/src/entityparser.cpp b/src/entityparser.cpp index 4386518..ae04065 100644 --- a/src/entityparser.cpp +++ b/src/entityparser.cpp @@ -36,7 +36,7 @@ EntityID parseEntity(const nlohmann::json& json, World* world) { light->type = componentObject["kind"]; } else if(componentType == "Camera") { - CameraComponent* camera = ECS::addComponent(entity); + ECS::addComponent(entity); } } diff --git a/src/worldmanager.cpp b/src/worldmanager.cpp index aa80445..0375158 100644 --- a/src/worldmanager.cpp +++ b/src/worldmanager.cpp @@ -28,8 +28,8 @@ void WorldManager::loadWorld(const std::string& path) { world->color[1] = atof(tokens[1].c_str()); world->color[2] = atof(tokens[2].c_str()); - for(auto entityObject : json["entities"]) - EntityID entity = parseEntity(entityObject, world); + for(const auto& entityObject : json["entities"]) + parseEntity(entityObject, world); loadedWorlds[path] = world; }