neteja cppcheck (44 → 0) i aïllar impls de tercers

This commit is contained in:
2026-05-16 17:53:50 +02:00
parent fe186ad39a
commit e31a3e9182
20 changed files with 151 additions and 196 deletions
+5 -9
View File
@@ -1,7 +1,9 @@
#include "game/gameplay/zone_manager.hpp"
#include <algorithm> // Para std::ranges::find_if, transform
#include <exception> // Para exception
#include <iostream> // Para cerr, cout
#include <iterator> // Para std::back_inserter
#include <string> // Para string
#include "core/resources/resource_helper.hpp" // Para Resource::Helper::loadFile
@@ -78,12 +80,8 @@ void ZoneManager::loadFromFile(const std::string& file_path) {
}
auto ZoneManager::getZone(const std::string& name) const -> const Zone::Data* {
for (const auto& zone : zones_) {
if (zone.name == name) {
return &zone;
}
}
return nullptr;
auto it = std::ranges::find_if(zones_, [&](const auto& z) { return z.name == name; });
return (it != zones_.end()) ? &(*it) : nullptr;
}
auto ZoneManager::getDefaultZone() const -> const Zone::Data* {
@@ -94,8 +92,6 @@ auto ZoneManager::getDefaultZone() const -> const Zone::Data* {
auto ZoneManager::getZoneNames() const -> std::vector<std::string> {
std::vector<std::string> names;
names.reserve(zones_.size());
for (const auto& zone : zones_) {
names.push_back(zone.name);
}
std::ranges::transform(zones_, std::back_inserter(names), [](const auto& z) { return z.name; });
return names;
}