tidy-fix automàtic (sense naming)

This commit is contained in:
2026-05-14 18:28:23 +02:00
parent 358e91ea30
commit b7a551c158
81 changed files with 1549 additions and 831 deletions
+25 -19
View File
@@ -102,16 +102,22 @@ namespace Overlay {
// Pinta un rectangle sòlid dins els límits de la pantalla
static void drawRect(Uint32* pixel_data, int rx, int ry, int rw, int rh, Uint32 color) {
for (int row = ry; row < ry + rh; row++) {
if (row < 0 || row >= SCREEN_H) continue;
if (row < 0 || row >= SCREEN_H) {
continue;
}
for (int col = rx; col < rx + rw; col++) {
if (col < 0 || col >= SCREEN_W) continue;
pixel_data[col + row * SCREEN_W] = color;
if (col < 0 || col >= SCREEN_W) {
continue;
}
pixel_data[col + (row * SCREEN_W)] = color;
}
}
}
void render(Uint32* pixel_data) {
if (!font_ || !pixel_data) return;
if (!font_ || (pixel_data == nullptr)) {
return;
}
// Calcula delta time
Uint32 now = SDL_GetTicks();
@@ -148,7 +154,9 @@ namespace Overlay {
break;
}
if (notif.status == Status::FINISHED) continue;
if (notif.status == Status::FINISHED) {
continue;
}
// Posició segons el tipus
int box_x = 0;
@@ -180,7 +188,7 @@ namespace Overlay {
int line_y = box_y + NOTIF_PADDING_V;
for (const auto& line : notif.lines) {
int line_w = font_->width(line.c_str());
int line_x = box_x + (notif.box_w - line_w) / 2; // centrat dins la caixa
int line_x = box_x + ((notif.box_w - line_w) / 2); // centrat dins la caixa
if (notif.style == NotifStyle::SHADOW) {
font_->draw(pixel_data, line_x + 1, line_y + 1, line.c_str(), notif.accent_color);
} else if (notif.style == NotifStyle::OUTLINE) {
@@ -203,7 +211,7 @@ namespace Overlay {
// Mateix lloc: entra fins a 1
if (info_anim_ < 1.0F) {
info_anim_ += INFO_SLIDE_SPEED * dt;
if (info_anim_ > 1.0F) info_anim_ = 1.0F;
info_anim_ = std::min(info_anim_, 1.0F);
}
} else {
// Canvi: si visible_pos està OFF, commuta directament
@@ -225,10 +233,10 @@ namespace Overlay {
float target = seg.visible ? 1.0F : 0.0F;
if (seg.anim < target) {
seg.anim += SEG_SPEED * dt;
if (seg.anim > target) seg.anim = target;
seg.anim = std::min(seg.anim, target);
} else if (seg.anim > target) {
seg.anim -= SEG_SPEED * dt;
if (seg.anim < target) seg.anim = target;
seg.anim = std::max(seg.anim, target);
}
}
@@ -283,9 +291,7 @@ namespace Overlay {
}
// Elimina les acabades
notifications_.erase(
std::remove_if(notifications_.begin(), notifications_.end(), [](const Notification& n) { return n.status == Status::FINISHED; }),
notifications_.end());
std::erase_if(notifications_, [](const Notification& n) { return n.status == Status::FINISHED; });
// Si la notificació d'ESC ha desaparegut, reseteja l'estat
if (esc_waiting_ && notifications_.empty()) {
@@ -293,7 +299,7 @@ namespace Overlay {
}
// Indicador de pausa persistent (cantó superior dret)
if (Director::get() && Director::get()->isPaused()) {
if ((Director::get() != nullptr) && Director::get()->isPaused()) {
const char* pause_text = Locale::get("notifications.pause");
int w = font_->width(pause_text);
int x = SCREEN_W - w - 4;
@@ -357,9 +363,7 @@ namespace Overlay {
}
// Neteja notificacions finalitzades
notifications_.erase(
std::remove_if(notifications_.begin(), notifications_.end(), [](const Notification& n) { return n.status == Status::FINISHED; }),
notifications_.end());
std::erase_if(notifications_, [](const Notification& n) { return n.status == Status::FINISHED; });
// Menú flotant per damunt de tot (isVisible inclou l'animació de tancament)
if (Menu::isVisible()) {
@@ -392,7 +396,7 @@ namespace Overlay {
int max_w = 0;
for (const auto& line : lines) {
int w = font_->width(line.c_str());
if (w > max_w) max_w = w;
max_w = std::max(w, max_w);
}
notif.box_w = max_w + NOTIF_PADDING_H * 2;
int line_h = font_->charHeight();
@@ -414,7 +418,7 @@ namespace Overlay {
void setRenderInfoSegments(const char* s0, const char* s1, const char* s2, const char* s3, unsigned int mono_mask) {
const char* segs[INFO_SEGMENT_COUNT] = {s0, s1, s2, s3};
for (int i = 0; i < INFO_SEGMENT_COUNT; i++) {
info_segments_[i].mono_digits = (mono_mask >> i) & 1u;
info_segments_[i].mono_digits = (((mono_mask >> i) & 1U) != 0u);
if (segs[i] != nullptr && *segs[i] != '\0') {
info_segments_[i].text = segs[i];
info_segments_[i].visible = true;
@@ -425,7 +429,9 @@ namespace Overlay {
}
void startCredits() {
if (credits_phase_ != CreditsPhase::IDLE) return;
if (credits_phase_ != CreditsPhase::IDLE) {
return;
}
credits_phase_ = CreditsPhase::DELAY;
credits_timer_ = 0.0F;
}