diff --git a/source/core/defaults/rendering.hpp b/source/core/defaults/rendering.hpp index c87d119..50cb2e4 100644 --- a/source/core/defaults/rendering.hpp +++ b/source/core/defaults/rendering.hpp @@ -3,7 +3,6 @@ #pragma once -#include #include namespace Defaults::Rendering { @@ -35,8 +34,12 @@ namespace Defaults::Rendering { constexpr int RENDER_HEIGHT_DEFAULT = 720; constexpr auto isValidRenderResolution(int w, int h) -> bool { - return std::ranges::any_of(RESOLUTION_PRESETS, - [w, h](const ResolutionPreset& preset) { return preset.w == w && preset.h == h; }); + for (const auto& preset : RESOLUTION_PRESETS) { + if (preset.w == w && preset.h == h) { + return true; + } + } + return false; } } // namespace Defaults::Rendering diff --git a/source/core/input/define_inputs.cpp b/source/core/input/define_inputs.cpp index f1f8350..487a4b0 100644 --- a/source/core/input/define_inputs.cpp +++ b/source/core/input/define_inputs.cpp @@ -3,7 +3,6 @@ #include "core/input/define_inputs.hpp" -#include #include #include #include @@ -154,9 +153,12 @@ namespace System { } auto DefineInputs::isInUse(int code) const -> bool { - return std::ranges::any_of(sequence_, [code](const Step& s) { - return s.captured == code; - }); + for (const auto& s : sequence_) { + if (s.captured == code) { + return true; + } + } + return false; } void DefineInputs::captureAndAdvance(int code) { diff --git a/source/core/input/input.cpp b/source/core/input/input.cpp index 80ff7e7..f63e603 100644 --- a/source/core/input/input.cpp +++ b/source/core/input/input.cpp @@ -2,7 +2,6 @@ #include // Para SDL_GetGamepadAxis, SDL_GamepadAxis, SDL_GamepadButton, SDL_GetError, SDL_JoystickID, SDL_AddGamepadMappingsFromFile, SDL_Event, SDL_EventType, SDL_GetGamepadButton, SDL_GetKeyboardState, SDL_INIT_GAMEPAD, SDL_InitSubSystem, SDL_LogError, SDL_OpenGamepad, SDL_PollEvent, SDL_WasInit, Sint16, SDL_Gamepad, SDL_LogCategory, SDL_Scancode -#include // Para std::ranges::any_of #include // Para basic_ostream, operator<<, cout, cerr #include // Para shared_ptr, __shared_ptr_access, allocator, operator==, make_shared #include // Para unordered_map, _Node_iterator, operator==, _Node_iterator_base, _Node_const_iterator @@ -166,9 +165,12 @@ auto Input::checkAnyButton(bool repeat) -> bool { // Comprueba si algún player (P1 o P2) presionó alguna acción de una lista auto Input::checkAnyPlayerAction(const std::span& actions, bool repeat) -> bool { - return std::ranges::any_of(actions, [this, repeat](const InputAction& action) { - return checkActionPlayer1(action, repeat) || checkActionPlayer2(action, repeat); - }); + for (const auto& action : actions) { + if (checkActionPlayer1(action, repeat) || checkActionPlayer2(action, repeat)) { + return true; + } + } + return false; } // Comprueba si hay algun mando conectado @@ -441,9 +443,13 @@ auto Input::addGamepad(int device_index) -> std::string { } auto Input::removeGamepad(SDL_JoystickID id) -> std::string { - auto it = std::ranges::find_if(gamepads_, [id](const std::shared_ptr& gamepad) { - return gamepad->instance_id == id; - }); + auto it = gamepads_.end(); + for (auto i = gamepads_.begin(); i != gamepads_.end(); ++i) { + if ((*i)->instance_id == id) { + it = i; + break; + } + } if (it != gamepads_.end()) { std::string name = (*it)->name; diff --git a/source/core/physics/physics_world.cpp b/source/core/physics/physics_world.cpp index 7eb5654..8473124 100644 --- a/source/core/physics/physics_world.cpp +++ b/source/core/physics/physics_world.cpp @@ -3,7 +3,6 @@ #include "core/physics/physics_world.hpp" -#include #include #include "core/physics/rigid_body.hpp" @@ -14,9 +13,12 @@ namespace Physics { if (body == nullptr) { return; } - if (std::ranges::find(bodies_, body) == bodies_.end()) { - bodies_.push_back(body); + for (const auto* b : bodies_) { + if (b == body) { + return; + } } + bodies_.push_back(body); } void PhysicsWorld::removeBody(RigidBody* body) { diff --git a/source/game/stage_system/stage_config.hpp b/source/game/stage_system/stage_config.hpp index d3979b9..38a9f45 100644 --- a/source/game/stage_system/stage_config.hpp +++ b/source/game/stage_system/stage_config.hpp @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include @@ -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; } }; diff --git a/source/game/title/ship_animator.cpp b/source/game/title/ship_animator.cpp index 8400d48..1f4db36 100644 --- a/source/game/title/ship_animator.cpp +++ b/source/game/title/ship_animator.cpp @@ -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) {