clang-tidy (amb el fuck de que no feien bona parella el clang de macos i el tidy de llvm)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "balloon_formations.hpp"
|
||||
|
||||
#include <algorithm> // Para max, min, copy
|
||||
#include <utility> // Para std::cmp_less
|
||||
#include <array> // Para array
|
||||
#include <cctype> // Para isdigit
|
||||
#include <cstddef> // Para size_t
|
||||
@@ -52,7 +53,7 @@ void BalloonFormations::initFormations() {
|
||||
{"RIGHT", Balloon::VELX_POSITIVE},
|
||||
{"LEFT", Balloon::VELX_NEGATIVE}};
|
||||
|
||||
if (!loadFormationsFromFile(Asset::get()->get("formations.txt"), variables)) {
|
||||
if (!loadFormationsFromFile(Asset::get()->getPath("formations.txt"), variables)) {
|
||||
// Fallback: cargar formaciones por defecto si falla la carga del archivo
|
||||
loadDefaultFormations();
|
||||
}
|
||||
@@ -78,7 +79,7 @@ auto BalloonFormations::loadFormationsFromFile(const std::string& filename, cons
|
||||
}
|
||||
|
||||
// Verificar si es una nueva formación
|
||||
if (line.substr(0, 10) == "formation:") {
|
||||
if (line.starts_with("formation:")) {
|
||||
// Guardar formación anterior si existe
|
||||
if (current_formation >= 0 && !current_params.empty()) {
|
||||
formations_.emplace_back(current_params);
|
||||
@@ -172,7 +173,7 @@ auto BalloonFormations::evaluateExpression(const std::string& expr, const std::m
|
||||
}
|
||||
|
||||
// Si es una variable simple
|
||||
if (variables.find(trimmed_expr) != variables.end()) {
|
||||
if (variables.contains(trimmed_expr)) {
|
||||
return variables.at(trimmed_expr);
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ auto BalloonFormations::evaluateSimpleExpression(const std::string& expr, const
|
||||
}
|
||||
|
||||
// Si no se encuentra operador, intentar como variable o número
|
||||
return variables.find(expr) != variables.end() ? variables.at(expr) : std::stof(expr);
|
||||
return variables.contains(expr) ? variables.at(expr) : std::stof(expr);
|
||||
}
|
||||
|
||||
auto BalloonFormations::trim(const std::string& str) -> std::string {
|
||||
@@ -262,7 +263,7 @@ void BalloonFormations::loadDefaultFormations() {
|
||||
|
||||
void BalloonFormations::initFormationPools() {
|
||||
// Intentar cargar pools desde archivo
|
||||
if (!loadPoolsFromFile(Asset::get()->get("pools.txt"))) {
|
||||
if (!loadPoolsFromFile(Asset::get()->getPath("pools.txt"))) {
|
||||
// Fallback: cargar pools por defecto si falla la carga del archivo
|
||||
loadDefaultPools();
|
||||
}
|
||||
@@ -346,7 +347,7 @@ auto BalloonFormations::parsePoolLine(const std::string& line) -> std::optional<
|
||||
int formation_id = std::stoi(token);
|
||||
|
||||
// Validar que el ID de formación existe
|
||||
if (formation_id >= 0 && formation_id < static_cast<int>(formations_.size())) {
|
||||
if (formation_id >= 0 && std::cmp_less(formation_id, formations_.size())) {
|
||||
formation_ids.push_back(formation_id);
|
||||
}
|
||||
}
|
||||
@@ -376,7 +377,7 @@ void BalloonFormations::loadDefaultPools() {
|
||||
|
||||
// Pool 0: Primeras 10 formaciones (o las que haya disponibles)
|
||||
Pool pool0;
|
||||
for (size_t i = 0; i < std::min(size_t(10), total_formations); ++i) {
|
||||
for (size_t i = 0; i < std::min(static_cast<size_t>(10), total_formations); ++i) {
|
||||
pool0.push_back(static_cast<int>(i));
|
||||
}
|
||||
if (!pool0.empty()) {
|
||||
@@ -386,7 +387,7 @@ void BalloonFormations::loadDefaultPools() {
|
||||
// Pool 1: Formaciones 10-19 (si existen)
|
||||
if (total_formations > 10) {
|
||||
Pool pool1;
|
||||
for (size_t i = 10; i < std::min(size_t(20), total_formations); ++i) {
|
||||
for (size_t i = 10; i < std::min(static_cast<size_t>(20), total_formations); ++i) {
|
||||
pool1.push_back(static_cast<int>(i));
|
||||
}
|
||||
if (!pool1.empty()) {
|
||||
@@ -398,11 +399,11 @@ void BalloonFormations::loadDefaultPools() {
|
||||
if (total_formations > 50) {
|
||||
Pool pool2;
|
||||
// Agregar algunas formaciones básicas
|
||||
for (size_t i = 0; i < std::min(size_t(5), total_formations); ++i) {
|
||||
for (size_t i = 0; i < std::min(static_cast<size_t>(5), total_formations); ++i) {
|
||||
pool2.push_back(static_cast<int>(i));
|
||||
}
|
||||
// Agregar algunas floaters si existen
|
||||
for (size_t i = 50; i < std::min(size_t(55), total_formations); ++i) {
|
||||
for (size_t i = 50; i < std::min(static_cast<size_t>(55), total_formations); ++i) {
|
||||
pool2.push_back(static_cast<int>(i));
|
||||
}
|
||||
if (!pool2.empty()) {
|
||||
@@ -413,7 +414,7 @@ void BalloonFormations::loadDefaultPools() {
|
||||
// Pool 3: Solo floaters (si existen formaciones 50+)
|
||||
if (total_formations > 50) {
|
||||
Pool pool3;
|
||||
for (size_t i = 50; i < std::min(size_t(70), total_formations); ++i) {
|
||||
for (size_t i = 50; i < std::min(static_cast<size_t>(70), total_formations); ++i) {
|
||||
pool3.push_back(static_cast<int>(i));
|
||||
}
|
||||
if (!pool3.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user