From 9efb327270d43be3a284d91ebd38fe8fad4a64d7 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 6 Jul 2024 02:55:19 +0300 Subject: [PATCH] refactor: minor cleanup --- src/objects/Entities.cpp | 8 ++++---- src/objects/EntityDef.hpp | 4 ++-- src/world/Level.hpp | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/objects/Entities.cpp b/src/objects/Entities.cpp index 7a305fee..88f72538 100644 --- a/src/objects/Entities.cpp +++ b/src/objects/Entities.cpp @@ -193,8 +193,8 @@ dynamic::Value Entities::serialize(const Entity& entity) { auto& rigmap = root->putMap("rig"); if (def.save.rig.textures) { auto& map = rigmap.putMap("textures"); - for (auto& entry : rig.textures) { - map.put(entry.first, entry.second); + for (auto& [slot, texture] : rig.textures) { + map.put(slot, texture); } } if (def.save.rig.pose) { @@ -363,8 +363,8 @@ std::vector Entities::getAllInside(AABB aabb) { if (found == uids.end()) { continue; } - if (auto entity = get(found->second)) { - collected.push_back(*entity); + if (auto wrapper = get(found->second)) { + collected.push_back(*wrapper); } } } diff --git a/src/objects/EntityDef.hpp b/src/objects/EntityDef.hpp index 1abfca14..47fc906c 100644 --- a/src/objects/EntityDef.hpp +++ b/src/objects/EntityDef.hpp @@ -21,7 +21,7 @@ struct EntityDef { glm::vec3 hitbox {0.5f}; std::vector> boxTriggers {}; std::vector> radialTriggers {}; - std::string rigName = name.substr(name.find(":")+1); + std::string rigName = name.substr(name.find(":") + 1); struct { bool enabled = true; @@ -35,7 +35,7 @@ struct EntityDef { entityid_t id; rigging::RigConfig* rig; } rt {}; - + EntityDef(const std::string& name) : name(name) {} EntityDef(const EntityDef&) = delete; }; diff --git a/src/world/Level.hpp b/src/world/Level.hpp index 3f57ac10..4b5a1f53 100644 --- a/src/world/Level.hpp +++ b/src/world/Level.hpp @@ -12,10 +12,8 @@ inline constexpr int DEF_PLAYER_INVENTORY_SIZE = 40; class Content; class World; -class Player; class Chunks; class Entities; -class Inventory; class Inventories; class LevelEvents; class Lighting;