clang-tidy

This commit is contained in:
2025-08-10 14:13:11 +02:00
parent 0204a8896a
commit c727cb6541
21 changed files with 255 additions and 209 deletions

View File

@@ -41,8 +41,12 @@ ServiceMenu::ServiceMenu()
}
void ServiceMenu::toggle() {
if (define_buttons_ && define_buttons_->isEnabled()) return;
if (isAnimating() && !define_buttons_->isEnabled()) return;
if (define_buttons_ && define_buttons_->isEnabled()) {
return;
}
if (isAnimating() && !define_buttons_->isEnabled()) {
return;
}
playBackSound();
@@ -83,7 +87,9 @@ void ServiceMenu::update() {
// El renderer siempre se actualiza para manejar sus animaciones
renderer_->update(this);
if (!enabled_) return;
if (!enabled_) {
return;
}
// Lógica de actualización del mensaje de reinicio y botones
bool now_pending = Options::pending_changes.has_pending_changes;
@@ -294,7 +300,7 @@ void ServiceMenu::initializeOptions() {
[this]() {
// Acción: configurar botones del mando del jugador 1
auto *gamepad = &Options::gamepad_manager.getGamepad(Player::Id::PLAYER1);
if (gamepad && gamepad->instance) {
if ((gamepad != nullptr) && gamepad->instance) {
define_buttons_->enable(gamepad);
}
}));
@@ -312,7 +318,7 @@ void ServiceMenu::initializeOptions() {
[this]() {
// Acción: configurar botones del mando del jugador 2
auto *gamepad = &Options::gamepad_manager.getGamepad(Player::Id::PLAYER2);
if (gamepad && gamepad->instance) {
if ((gamepad != nullptr) && gamepad->instance) {
define_buttons_->enable(gamepad);
}
}));
@@ -565,17 +571,17 @@ void ServiceMenu::handleEvent(const SDL_Event &event) {
}
}
bool ServiceMenu::checkInput() {
auto ServiceMenu::checkInput() -> bool {
// --- Guardas ---
// No procesar input si el menú no está habilitado, si se está animando o si se definen botones
if (!enabled_ || isAnimating() || (define_buttons_ && define_buttons_->isEnabled())) {
return false;
}
static auto input = Input::get();
static auto *input_ = Input::get();
using Action = Input::Action;
const std::vector<std::pair<Action, std::function<void()>>> actions = {
const std::vector<std::pair<Action, std::function<void()>>> ACTIONS = {
{Action::UP, [this]() { setSelectorUp(); }},
{Action::DOWN, [this]() { setSelectorDown(); }},
{Action::RIGHT, [this]() { adjustOption(true); }},
@@ -585,17 +591,17 @@ bool ServiceMenu::checkInput() {
};
// Teclado
for (const auto &[action, func] : actions) {
if (input->checkAction(action, Input::DO_NOT_ALLOW_REPEAT, Input::CHECK_KEYBOARD)) {
for (const auto &[action, func] : ACTIONS) {
if (input_->checkAction(action, Input::DO_NOT_ALLOW_REPEAT, Input::CHECK_KEYBOARD)) {
func();
return true;
}
}
// Mandos
for (auto gamepad : input->getGamepads()) {
for (const auto &[action, func] : actions) {
if (input->checkAction(action, Input::DO_NOT_ALLOW_REPEAT, Input::DO_NOT_CHECK_KEYBOARD, gamepad)) {
for (auto gamepad : input_->getGamepads()) {
for (const auto &[action, func] : ACTIONS) {
if (input_->checkAction(action, Input::DO_NOT_ALLOW_REPEAT, Input::DO_NOT_CHECK_KEYBOARD, gamepad)) {
func();
return true;
}