elimina NOLINT obsolets (241 marques que ja no disparaven warning)

This commit is contained in:
2026-05-17 12:18:19 +02:00
parent 9b6d6747b5
commit 62935bf892
42 changed files with 246 additions and 246 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ void Credits::handleInput() {
}
// Inicializa los textos
void Credits::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
void Credits::iniTexts() {
const auto* loc = Locale::get();
texts_.clear();
+2 -2
View File
@@ -169,7 +169,7 @@ void Ending::updateState(float delta_time) {
}
// Inicializa los textos
void Ending::iniTexts() { // NOLINT(readability-convert-member-functions-to-static)
void Ending::iniTexts() {
// Vector con los textos (traducidos según el idioma activo)
std::vector<TextAndPosition> texts;
const auto* loc = Locale::get();
@@ -273,7 +273,7 @@ void Ending::iniPics() {
}
// Inicializa las escenas
void Ending::iniScenes() { // NOLINT(readability-convert-member-functions-to-static)
void Ending::iniScenes() {
// Variable para los tiempos
int trigger;
constexpr int LAPSE = 80;
+3 -3
View File
@@ -391,7 +391,7 @@ void Ending2::placeSprites() const {
}
// Crea los sprites con las texturas con los textos
void Ending2::createSpriteTexts() { // NOLINT(readability-convert-member-functions-to-static)
void Ending2::createSpriteTexts() {
// Crea los sprites de texto a partir de la lista
for (size_t i = 0; i < sprite_list_.size(); ++i) {
auto text = Resource::Cache::get()->getText("smb2");
@@ -400,7 +400,7 @@ void Ending2::createSpriteTexts() { // NOLINT(readability-convert-member-functi
std::string txt = sprite_list_[i];
std::ranges::replace(txt, '_', ' '); // Reemplaza '_' por ' '
if (txt == "player") {
txt = Locale::get()->get("ending2.jaildoctor"); // NOLINT(readability-static-accessed-through-instance) Reemplaza "player" por nombre localizado
txt = Locale::get()->get("ending2.jaildoctor"); // Reemplaza "player" por nombre localizado
}
// Calcula las dimensiones del texto
@@ -432,7 +432,7 @@ void Ending2::createSpriteTexts() { // NOLINT(readability-convert-member-functi
}
// Crea los sprites con las texturas con los textos del final
void Ending2::createTexts() { // NOLINT(readability-convert-member-functions-to-static)
void Ending2::createTexts() {
// Crea los primeros textos
std::vector<std::string> list;
list.emplace_back(Locale::get()->get("ending2.starring"));
+18 -18
View File
@@ -214,10 +214,10 @@ void Game::handleEvent(const SDL_Event& event) {
if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_9 && static_cast<int>(event.key.repeat) == 0) {
if (MapEditor::get()->isActive()) {
GameControl::exit_editor();
Notifier::get()->show({Locale::get()->get("game.editor_disabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("game.editor_disabled")});
} else {
GameControl::enter_editor();
Notifier::get()->show({Locale::get()->get("game.editor_enabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("game.editor_enabled")});
}
} else if (event.type == SDL_EVENT_KEY_DOWN && event.key.key == SDLK_8 && static_cast<int>(event.key.repeat) == 0 && MapEditor::get()->isActive()) {
MapEditor::get()->showGrid(!MapEditor::get()->isGridEnabled());
@@ -262,9 +262,9 @@ void Game::handleInput() {
}
// Input de pausa solo en estado PLAYING
if (Input::get()->checkAction(InputAction::PAUSE, Input::DO_NOT_ALLOW_REPEAT)) { // NOLINT(readability-static-accessed-through-instance)
if (Input::get()->checkAction(InputAction::PAUSE, Input::DO_NOT_ALLOW_REPEAT)) {
togglePause();
Notifier::get()->show({paused_ ? Locale::get()->get("game.paused") : Locale::get()->get("game.running")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({paused_ ? Locale::get()->get("game.paused") : Locale::get()->get("game.running")});
}
GlobalInputs::handle();
@@ -543,7 +543,7 @@ void Game::renderPostFadeEnding() {
static void toggleCheat(Options::Cheat::State& cheat, const std::string& label) {
cheat = (cheat == Options::Cheat::State::ENABLED) ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
const bool ENABLED = (cheat == Options::Cheat::State::ENABLED);
Notifier::get()->show({label + (ENABLED ? Locale::get()->get("game.enabled") : Locale::get()->get("game.disabled"))}, Notifier::Style::DEFAULT, -1, true); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({label + (ENABLED ? Locale::get()->get("game.enabled") : Locale::get()->get("game.disabled"))}, Notifier::Style::DEFAULT, -1, true);
}
// Pone la información de debug en pantalla
@@ -574,7 +574,7 @@ void Game::renderDebugInfo() {
}
// Comprueba los eventos
void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-convert-member-functions-to-static)
void Game::handleDebugEvents(const SDL_Event& event) {
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 0) {
switch (event.key.key) {
case SDLK_R:
@@ -598,21 +598,21 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
break;
case SDLK_1:
toggleCheat(Options::cheats.infinite_lives, Locale::get()->get("game.cheat_infinite_lives")); // NOLINT(readability-static-accessed-through-instance)
toggleCheat(Options::cheats.infinite_lives, Locale::get()->get("game.cheat_infinite_lives"));
player_->setColor();
break;
case SDLK_2:
toggleCheat(Options::cheats.invincible, Locale::get()->get("game.cheat_invincible")); // NOLINT(readability-static-accessed-through-instance)
toggleCheat(Options::cheats.invincible, Locale::get()->get("game.cheat_invincible"));
player_->setColor();
break;
case SDLK_3:
toggleCheat(Options::cheats.jail_is_open, Locale::get()->get("game.cheat_jail_open")); // NOLINT(readability-static-accessed-through-instance)
toggleCheat(Options::cheats.jail_is_open, Locale::get()->get("game.cheat_jail_open"));
break;
case SDLK_7:
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c11")}, Notifier::Style::CHEEVO, -1, false, "F7"); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Locale::get()->get("achievements.header"), Locale::get()->get("achievements.c11")}, Notifier::Style::CHEEVO, -1, false, "F7");
break;
case SDLK_0: {
@@ -621,7 +621,7 @@ void Game::handleDebugEvents(const SDL_Event& event) { // NOLINT(readability-co
invincible_before_debug_ = (Options::cheats.invincible == Options::Cheat::State::ENABLED);
}
Debug::get()->toggleEnabled();
Notifier::get()->show({Debug::get()->isEnabled() ? Locale::get()->get("game.debug_enabled") : Locale::get()->get("game.debug_disabled")}); // NOLINT(readability-static-accessed-through-instance)
Notifier::get()->show({Debug::get()->isEnabled() ? Locale::get()->get("game.debug_enabled") : Locale::get()->get("game.debug_disabled")});
room_->redrawMap();
if (Debug::get()->isEnabled()) {
Options::cheats.invincible = Options::Cheat::State::ENABLED;
@@ -728,7 +728,7 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
}
// Verifica que exista el fichero que se va a cargar
if (!Resource::List::get()->get(room_path).empty()) { // NOLINT(readability-static-accessed-through-instance)
if (!Resource::List::get()->get(room_path).empty()) {
// Crea un objeto habitación nuevo a partir del fichero
room_ = std::make_shared<Room>(room_path, scoreboard_data_);
@@ -830,7 +830,7 @@ void Game::killPlayer() {
}
// Pone el color del marcador en función del color del borde de la habitación
void Game::setScoreBoardColor() { // NOLINT(readability-convert-member-functions-to-static)
void Game::setScoreBoardColor() {
// Obtiene el color del borde
const Uint8 BORDER_COLOR = room_->getBorderColor();
@@ -905,12 +905,12 @@ void Game::checkRestoringJail(float delta_time) {
}
// Inicializa las estadísticas
void Game::initStats() { // NOLINT(readability-convert-member-functions-to-static)
void Game::initStats() {
stats_->init();
}
// Crea la textura con el nombre de la habitación
void Game::fillRoomNameTexture() { // NOLINT(readability-convert-member-functions-to-static)
void Game::fillRoomNameTexture() {
// Pone la textura como destino de renderizado
auto previuos_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(room_name_surface_);
@@ -927,7 +927,7 @@ void Game::fillRoomNameTexture() { // NOLINT(readability-convert-member-functio
}
// Comprueba algunos logros
void Game::checkSomeCheevos() { // NOLINT(readability-convert-member-functions-to-static)
void Game::checkSomeCheevos() {
auto* cheevos = Cheevos::get();
// Logros sobre la cantidad de items
@@ -961,7 +961,7 @@ void Game::checkSomeCheevos() { // NOLINT(readability-convert-member-functions-
}
// Comprueba los logros de completar el juego
void Game::checkEndGameCheevos() { // NOLINT(readability-convert-member-functions-to-static)
void Game::checkEndGameCheevos() {
auto* cheevos = Cheevos::get();
// "Complete the game"
@@ -985,7 +985,7 @@ void Game::checkEndGameCheevos() { // NOLINT(readability-convert-member-functio
}
// Inicializa al jugador
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) { // NOLINT(readability-convert-member-functions-to-static)
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) {
const bool IGNORE_INPUT = player_ != nullptr && player_->getIgnoreInput();
std::string player_animations = Player::skinToAnimationPath(Options::game.player_skin);
const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = player_animations, .room = std::move(room)};
+4 -4
View File
@@ -68,7 +68,7 @@ void GameOver::render() {
// Escribe el texto de GAME OVER
const auto* loc = Locale::get();
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y, loc->get("game_over.title"), 1, color_); // NOLINT(readability-static-accessed-through-instance)
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y, loc->get("game_over.title"), 1, color_);
// Dibuja los sprites (ya posicionados en el constructor, solo ajustamos Y)
player_sprite_->setPosY(TEXT_Y + SPRITE_Y_OFFSET);
@@ -78,11 +78,11 @@ void GameOver::render() {
// Escribe el texto con las habitaciones y los items
const std::string ITEMS_TEXT = std::to_string(Options::stats.items / 100) + std::to_string((Options::stats.items % 100) / 10) + std::to_string(Options::stats.items % 10);
const std::string ROOMS_TEXT = std::to_string(Options::stats.rooms / 100) + std::to_string((Options::stats.rooms % 100) / 10) + std::to_string(Options::stats.rooms % 10);
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + ITEMS_Y_OFFSET, loc->get("game_over.items") + ITEMS_TEXT, 1, color_); // NOLINT(readability-static-accessed-through-instance)
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + ROOMS_Y_OFFSET, loc->get("game_over.rooms") + ROOMS_TEXT, 1, color_); // NOLINT(readability-static-accessed-through-instance)
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + ITEMS_Y_OFFSET, loc->get("game_over.items") + ITEMS_TEXT, 1, color_);
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + ROOMS_Y_OFFSET, loc->get("game_over.rooms") + ROOMS_TEXT, 1, color_);
// Escribe el texto con "Tu peor pesadilla"
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + NIGHTMARE_TITLE_Y_OFFSET, loc->get("game_over.worst_nightmare"), 1, color_); // NOLINT(readability-static-accessed-through-instance)
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + NIGHTMARE_TITLE_Y_OFFSET, loc->get("game_over.worst_nightmare"), 1, color_);
text->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, GameCanvas::CENTER_X, TEXT_Y + NIGHTMARE_TEXT_Y_OFFSET, Options::stats.worst_nightmare, 1, color_);
// Vuelca el contenido del renderizador en pantalla
+2 -2
View File
@@ -67,7 +67,7 @@ void LoadingScreen::handleInput() {
}
// Inicializa el array de índices de líneas (imita el direccionamiento de memoria del Spectrum)
void LoadingScreen::initLineIndexArray() { // NOLINT(readability-convert-member-functions-to-static)
void LoadingScreen::initLineIndexArray() {
for (int i = 0; i < MONO_TOTAL_LINES; ++i) {
if (i < 64) { // Primer bloque de 2K
line_index_[i] = ((i % 8) * 8) + (i / 8);
@@ -440,7 +440,7 @@ void LoadingScreen::renderBorder() {
}
// Escribe el nombre del programa
void LoadingScreen::printProgramName() { // NOLINT(readability-convert-member-functions-to-static)
void LoadingScreen::printProgramName() {
auto previous_renderer = Screen::get()->getRendererSurface();
Screen::get()->setRendererSurface(screen_surface_);
program_sprite_->render();
+4 -4
View File
@@ -91,7 +91,7 @@ void Logo::updateJAILGAMES(float delta_time) {
}
// Calcula el índice de color según el progreso (0.0-1.0)
auto Logo::getColorIndex(float progress) const -> int { // NOLINT(readability-convert-member-functions-to-static)
auto Logo::getColorIndex(float progress) const -> int {
// Asegurar que progress esté en el rango [0.0, 1.0]
progress = std::clamp(progress, 0.0F, 1.0F);
@@ -209,7 +209,7 @@ void Logo::update() {
}
// Dibuja en pantalla
void Logo::render() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::render() {
// Prepara para empezar a dibujar en la textura de juego
Screen::get()->start();
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
@@ -245,7 +245,7 @@ void Logo::endSection() {
}
// Inicializa el vector de colores
void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::initColors() {
// Inicializa el vector de colores
const std::vector<Uint8> COLORS = {
static_cast<Uint8>(PaletteColor::BLACK),
@@ -261,7 +261,7 @@ void Logo::initColors() { // NOLINT(readability-convert-member-functions-to-sta
}
// Crea los sprites de cada linea
void Logo::initSprites() { // NOLINT(readability-convert-member-functions-to-static)
void Logo::initSprites() {
const float WIDTH = jailgames_surface_->getWidth();
jailgames_initial_x_.reserve(jailgames_surface_->getHeight());
+13 -13
View File
@@ -452,7 +452,7 @@ void Title::iterate() {
}
// Crea y rellena la textura para mostrar los logros
void Title::createCheevosTexture() { // NOLINT(readability-convert-member-functions-to-static)
void Title::createCheevosTexture() {
// Define la zona central del menu (entre el logo y la marquesina)
constexpr int MENU_ZONE_Y = 73; // Top of menu zone
constexpr int MENU_ZONE_HEIGHT = 102; // Height of menu zone
@@ -476,7 +476,7 @@ void Title::createCheevosTexture() { // NOLINT(readability-convert-member-funct
cheevos_surface_->clear(CHEEVOS_BG_COLOR);
// Escribe la lista de logros en la textura
const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects"); // NOLINT(readability-static-accessed-through-instance)
const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects");
const std::string CHEEVOS_LIST_CAPTION = CHEEVOS_OWNER + " (" + std::to_string(Cheevos::get()->getTotalUnlockedAchievements()) + " / " + std::to_string(Cheevos::get()->size()) + ")";
int pos = 2;
TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, stringToColor("bright_green"));
@@ -642,7 +642,7 @@ auto Title::isKeyValid(SDL_Scancode scancode) -> bool {
}
// Verifica si una tecla ya fue usada en pasos anteriores
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool {
for (int i = 0; i < current_step; i++) {
if (temp_keys_[i] == scancode) {
return true;
@@ -653,7 +653,7 @@ auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool { /
// Retorna el nombre de la accion para el paso actual
// Aplica y guarda las teclas redefinidas
void Title::applyKeyboardRemap() { // NOLINT(readability-convert-member-functions-to-static)
void Title::applyKeyboardRemap() {
// Guardar las nuevas teclas en Options::controls
Options::keyboard_controls.key_left = temp_keys_[0];
Options::keyboard_controls.key_right = temp_keys_[1];
@@ -694,17 +694,17 @@ void Title::renderKeyboardRemap() const {
const int KEYS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_KEY = SDL_GetScancodeName(temp_keys_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_KEY = SDL_GetScancodeName(temp_keys_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_KEY = SDL_GetScancodeName(temp_keys_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY; // NOLINT(readability-static-accessed-through-instance)
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -742,17 +742,17 @@ void Title::renderJoystickRemap() const {
const int BUTTONS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_BTN = getButtonName(temp_buttons_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_BTN = getButtonName(temp_buttons_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_BTN = getButtonName(temp_buttons_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN; // NOLINT(readability-static-accessed-through-instance)
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN;
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -824,7 +824,7 @@ void Title::handleJoystickRemap(const SDL_Event& event) {
}
// Valida si un botón está duplicado
auto Title::isButtonDuplicate(int button, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto Title::isButtonDuplicate(int button, int current_step) -> bool {
for (int i = 0; i < current_step; ++i) {
if (temp_buttons_[i] == button) {
return true;
@@ -834,7 +834,7 @@ auto Title::isButtonDuplicate(int button, int current_step) -> bool { // NOLINT
}
// Aplica y guarda los botones del gamepad redefinidos
void Title::applyJoystickRemap() { // NOLINT(readability-convert-member-functions-to-static)
void Title::applyJoystickRemap() {
// Guardar los nuevos botones en Options::gamepad_controls
Options::gamepad_controls.button_left = temp_buttons_[0];
Options::gamepad_controls.button_right = temp_buttons_[1];
@@ -848,7 +848,7 @@ void Title::applyJoystickRemap() { // NOLINT(readability-convert-member-functio
}
// Retorna el nombre amigable del botón del gamepad
auto Title::getButtonName(int button) -> std::string { // NOLINT(readability-convert-member-functions-to-static)
auto Title::getButtonName(int button) -> std::string {
// Triggers especiales
if (button == Input::TRIGGER_L2_AS_BUTTON) {
return "L2";