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:
@@ -42,8 +42,12 @@ struct ConfigPartida {
|
||||
// Retorna l'ID de l'únic jugador actiu (0 o 1)
|
||||
// Només vàlid si es_un_jugador() retorna true
|
||||
[[nodiscard]] uint8_t id_unic_jugador() const {
|
||||
if (jugador1_actiu && !jugador2_actiu) return 0;
|
||||
if (!jugador1_actiu && jugador2_actiu) return 1;
|
||||
if (jugador1_actiu && !jugador2_actiu) {
|
||||
return 0;
|
||||
}
|
||||
if (!jugador1_actiu && jugador2_actiu) {
|
||||
return 1;
|
||||
}
|
||||
return 0; // Fallback (cal comprovar es_un_jugador() primer)
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user