style: aplicar todos los checks readability-* (225 fixes)

Cambios aplicados:
- readability-braces-around-statements (añadir llaves en ifs/fors)
- readability-implicit-bool-conversion (puntero → bool explícito)
- readability-container-size-empty (.empty() en lugar de .size()==0)
- readability-container-contains (.contains() C++20)
- readability-make-member-function-const (métodos const)
- readability-else-after-return (5 casos adicionales)
- Añadido #include <cmath> en defaults.hpp

Checks excluidos (justificados):
- identifier-naming: Cascada de 300+ cambios
- identifier-length: Nombres cortos son OK en este proyecto
- magic-numbers: Demasiados falsos positivos
- convert-member-functions-to-static: Rompe encapsulación
- use-anyofallof: C++20 ranges no universal
- function-cognitive-complexity: Complejidad aceptable
- clang-analyzer-security.insecureAPI.rand: rand() suficiente para juegos
This commit is contained in:
2025-12-18 19:51:43 +01:00
parent 2088ccdcc6
commit fdfb84170f
28 changed files with 258 additions and 167 deletions

View File

@@ -3,6 +3,7 @@
#include "escena_titol.hpp"
#include <algorithm>
#include <cfloat>
#include <cmath>
#include <iostream>
@@ -265,9 +266,7 @@ void EscenaTitol::executar() {
last_time = current_time;
// Limitar delta_time per evitar grans salts
if (delta_time > 0.05F) {
delta_time = 0.05F;
}
delta_time = std::min(delta_time, 0.05F);
// Actualitzar comptador de FPS
sdl_.updateFPS(delta_time);
@@ -567,7 +566,7 @@ void EscenaTitol::dibuixar() {
// === Calcular i renderitzar ombra (només si animació activa) ===
if (animacio_activa_) {
float temps_shadow = temps_animacio_ - SHADOW_DELAY;
if (temps_shadow < 0.0F) temps_shadow = 0.0F; // Evitar temps negatiu
temps_shadow = std::max(temps_shadow, 0.0F); // Evitar temps negatiu
// Usar amplituds i freqüències completes per l'ombra
float amplitude_x_shadow = ORBIT_AMPLITUDE_X;
@@ -676,13 +675,17 @@ void EscenaTitol::dibuixar() {
// Línea 1: Original (© 1999 Visente i Sergi)
std::string copyright_original = Project::COPYRIGHT_ORIGINAL;
for (char& c : copyright_original) {
if (c >= 'a' && c <= 'z') c = c - 32; // Uppercase
if (c >= 'a' && c <= 'z') {
c = c - 32; // Uppercase
}
}
// Línea 2: Port (© 2025 jaildesigner)
std::string copyright_port = Project::COPYRIGHT_PORT;
for (char& c : copyright_port) {
if (c >= 'a' && c <= 'z') c = c - 32; // Uppercase
if (c >= 'a' && c <= 'z') {
c = c - 32; // Uppercase
}
}
// Calcular posicions (anclatge des del top + separació)