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:
2026-03-23 12:03:07 +01:00
parent 3ca744ee46
commit a1d17ccf99
72 changed files with 487 additions and 484 deletions
+7 -6
View File
@@ -5,6 +5,7 @@
#include <algorithm> // Para max
#include <cstdlib> // Para rand, size_t
#include <functional> // Para function
#include <utility> // Para std::cmp_less
#include <vector> // Para vector
#include "audio.hpp" // Para Audio
@@ -34,7 +35,7 @@ HiScoreTable::HiScoreTable()
fade_(std::make_unique<Fade>()),
background_(std::make_unique<Background>()),
view_area_(SDL_FRect{0, 0, param.game.width, param.game.height}),
view_area_(SDL_FRect{.x = 0, .y = 0, .w = param.game.width, .h = param.game.height}),
fade_mode_(Fade::Mode::IN),
background_fade_color_(Color(0, 0, 0)) {
// Inicializa el resto
@@ -145,7 +146,7 @@ void HiScoreTable::updateFade(float delta_time) {
fade_->update(delta_time);
if (fade_->hasEnded() && fade_mode_ == Fade::Mode::IN) {
fade_->reset();
(*fade_).reset();
fade_mode_ = Fade::Mode::OUT;
fade_->setMode(fade_mode_);
}
@@ -163,7 +164,7 @@ auto HiScoreTable::format(int number) -> std::string {
const std::string SEPARATOR = ".";
const std::string SCORE = std::to_string(number);
auto index = (int)SCORE.size() - 1;
auto index = static_cast<int>(SCORE.size()) - 1;
std::string result;
auto i = 0;
while (index >= 0) {
@@ -211,7 +212,7 @@ void HiScoreTable::createSprites() {
const auto NUM_DOTS = ENTRY_LENGTH - Options::settings.hi_score_table.at(i).name.size() - SCORE.size();
const auto* const ONE_CC = Options::settings.hi_score_table.at(i).one_credit_complete ? " }" : "";
std::string dots;
for (int j = 0; j < (int)NUM_DOTS; ++j) {
for (int j = 0; std::cmp_less(j, NUM_DOTS); ++j) {
dots = dots + ".";
}
const auto LINE = TABLE_POSITION + Options::settings.hi_score_table.at(i).name + dots + SCORE + ONE_CC;
@@ -264,7 +265,7 @@ void HiScoreTable::updateSprites(float delta_time) {
if (elapsed_time_ >= INIT_DELAY_S) {
const float ELAPSED_SINCE_INIT = elapsed_time_ - INIT_DELAY_S;
int index = static_cast<int>(ELAPSED_SINCE_INIT / ENTRY_DELAY_S);
if (index < static_cast<int>(entry_names_.size()) && index >= 0) {
if (std::cmp_less(index, entry_names_.size()) && index >= 0) {
// Verificar si este índice debe activarse ahora
float expected_time = index * ENTRY_DELAY_S;
if (ELAPSED_SINCE_INIT >= expected_time && ELAPSED_SINCE_INIT < expected_time + delta_time) {
@@ -340,7 +341,7 @@ auto HiScoreTable::getEntryColor(int counter) -> Color {
if (n < entry_colors_.size()) {
index = n; // Avanza: 0,1,2,3
} else {
index = 2 * (entry_colors_.size() - 1) - n; // Retrocede: 2,1
index = (2 * (entry_colors_.size() - 1)) - n; // Retrocede: 2,1
}
return entry_colors_[index];