clang-tidy readability

This commit is contained in:
2025-07-20 14:56:00 +02:00
parent f5245273a1
commit ca99f7be34
57 changed files with 623 additions and 557 deletions

View File

@@ -51,21 +51,24 @@ void PathSprite::render() {
// Añade un recorrido
void PathSprite::addPath(Path path, bool centered) {
PathCentered path_centered = PathCentered::NONE;
if (centered)
if (centered) {
path_centered = (path.spots.back().x == path.spots.front().x) ? PathCentered::ON_X : PathCentered::ON_Y;
}
switch (path_centered) {
case PathCentered::ON_X: {
const int X = path.spots.back().x - pos_.w / 2;
for (auto &spot : path.spots)
for (auto &spot : path.spots) {
spot.x = X;
}
paths_.emplace_back(path);
break;
}
case PathCentered::ON_Y: {
const int Y = path.spots.back().y - pos_.h / 2;
for (auto &spot : path.spots)
for (auto &spot : path.spots) {
spot.y = Y;
}
paths_.emplace_back(path);
break;
}
@@ -87,7 +90,7 @@ void PathSprite::addPath(std::vector<SDL_FPoint> spots, int waiting_counter) {
// Habilita el objeto
void PathSprite::enable() {
if (paths_.size() == 0 || enabled_) {
if (paths_.empty() || enabled_) {
return;
}
@@ -141,4 +144,4 @@ void PathSprite::goToNextPathOrDie() {
}
// Indica si ha terminado todos los recorridos
auto PathSprite::hasFinished() -> bool { return has_finished_; }
auto PathSprite::hasFinished() const -> bool { return has_finished_; }