refactor: tornar std::ranges::{any,all,find}_of a bucles for explícits

This commit is contained in:
2026-05-26 13:45:54 +02:00
parent 0dcecf9a3c
commit 97d3749269
5 changed files with 43 additions and 22 deletions
+6 -4
View File
@@ -3,7 +3,6 @@
#pragma once
#include <algorithm>
#include <cstdint>
#include <string>
#include <vector>
@@ -56,9 +55,12 @@ namespace StageSystem {
if (stage_id == 0 || waves.empty()) {
return false;
}
return std::ranges::all_of(waves, [](const WaveConfig& w) {
return w.next.isValid() && !w.spawn.empty();
});
for (const auto& w : waves) {
if (!w.next.isValid() || w.spawn.empty()) {
return false;
}
}
return true;
}
};
+12 -4
View File
@@ -225,13 +225,21 @@ namespace Title {
}
auto ShipAnimator::isVisible() const -> bool {
return std::ranges::any_of(ships_,
[](const TitleShip& s) { return s.visible; });
for (const auto& s : ships_) {
if (s.visible) {
return true;
}
}
return false;
}
auto ShipAnimator::isAnimationComplete() const -> bool {
return std::ranges::all_of(ships_,
[](const TitleShip& s) { return !s.visible; });
for (const auto& s : ships_) {
if (s.visible) {
return false;
}
}
return true;
}
void ShipAnimator::updateEntering(TitleShip& ship, float delta_time) {