passant linters a vore si trobe variables sense inicialitzar

This commit is contained in:
2025-08-17 00:23:59 +02:00
parent ada5025c65
commit 327987447d
55 changed files with 516 additions and 474 deletions

View File

@@ -18,7 +18,7 @@
Notifier* Notifier::instance = nullptr;
// Inicializa la instancia única del singleton
void Notifier::init(const std::string& icon_file, std::shared_ptr<Text> text) { Notifier::instance = new Notifier(icon_file, text); }
void Notifier::init(const std::string& icon_file, std::shared_ptr<Text> text) { Notifier::instance = new Notifier(icon_file, std::move(text)); }
// Libera la instancia
void Notifier::destroy() { delete Notifier::instance; }
@@ -27,7 +27,7 @@ void Notifier::destroy() { delete Notifier::instance; }
auto Notifier::get() -> Notifier* { return Notifier::instance; }
// Constructor
Notifier::Notifier(std::string icon_file, std::shared_ptr<Text> text)
Notifier::Notifier(const std::string& icon_file, std::shared_ptr<Text> text)
: renderer_(Screen::get()->getRenderer()),
icon_texture_(!icon_file.empty() ? std::make_unique<Texture>(renderer_, icon_file) : nullptr),
text_(std::move(text)),
@@ -300,6 +300,7 @@ void Notifier::clearAllNotifications() {
// Obtiene los códigos de las notificaciones
auto Notifier::getCodes() -> std::vector<std::string> {
std::vector<std::string> codes;
codes.reserve(notifications_.size());
for (const auto& notification : notifications_) {
codes.emplace_back(notification.code);
}

View File

@@ -98,7 +98,7 @@ class Notifier {
void transitionToStayState(int index); // Cambia el estado de una notificación de RISING a STAY cuando ha alcanzado su posición final
// --- Constructores y destructor privados (singleton) ---
Notifier(std::string icon_file, std::shared_ptr<Text> text); // Constructor privado
Notifier(const std::string &icon_file, std::shared_ptr<Text> text); // Constructor privado
~Notifier() = default; // Destructor privado
// --- Instancia singleton ---

View File

@@ -1,5 +1,7 @@
#include "ui/service_menu.h"
#include <utility>
#include "audio.h" // Para Audio
#include "define_buttons.h" // Para DefineButtons
#include "difficulty.h" // Para getCodeFromName, getNameFromCode
@@ -596,7 +598,7 @@ auto ServiceMenu::checkInput() -> bool {
}
// Mandos
for (auto gamepad : input_->getGamepads()) {
for (const 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();
@@ -629,7 +631,7 @@ void ServiceMenu::refresh() {
// Método para registrar callback
void ServiceMenu::setStateChangeCallback(StateChangeCallback callback) {
state_change_callback_ = callback;
state_change_callback_ = std::move(callback);
}
// Método interno que cambia estado y notifica