neteja NOLINT identifier-naming i lambdes a metodes privats Game
This commit is contained in:
@@ -15,7 +15,7 @@ namespace GIF {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inicializa el diccionario LZW con los valores iniciales
|
// Inicializa el diccionario LZW con los valores iniciales
|
||||||
inline void initializeDictionary(std::vector<DictionaryEntry>& dictionary, int code_length, int& dictionary_ind) { // NOLINT(readability-identifier-naming)
|
inline void initializeDictionary(std::vector<DictionaryEntry>& dictionary, int code_length, int& dictionary_ind) {
|
||||||
int size = 1 << code_length;
|
int size = 1 << code_length;
|
||||||
dictionary.resize(1 << (code_length + 1));
|
dictionary.resize(1 << (code_length + 1));
|
||||||
for (dictionary_ind = 0; dictionary_ind < size; dictionary_ind++) {
|
for (dictionary_ind = 0; dictionary_ind < size; dictionary_ind++) {
|
||||||
@@ -55,7 +55,7 @@ namespace GIF {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Agrega una nueva entrada al diccionario
|
// Agrega una nueva entrada al diccionario
|
||||||
inline void addDictionaryEntry(std::vector<DictionaryEntry>& dictionary, int& dictionary_ind, int& code_length, int prev, int code) { // NOLINT(readability-identifier-naming)
|
inline void addDictionaryEntry(std::vector<DictionaryEntry>& dictionary, int& dictionary_ind, int& code_length, int prev, int code) {
|
||||||
uint8_t first_byte;
|
uint8_t first_byte;
|
||||||
if (code == dictionary_ind) {
|
if (code == dictionary_ind) {
|
||||||
first_byte = findFirstByte(dictionary, prev);
|
first_byte = findFirstByte(dictionary, prev);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XOR encryption (symmetric - same function for encrypt/decrypt)
|
// XOR encryption (symmetric - same function for encrypt/decrypt)
|
||||||
void Pack::encryptData(std::vector<uint8_t>& data, const std::string& key) { // NOLINT(readability-identifier-naming)
|
void Pack::encryptData(std::vector<uint8_t>& data, const std::string& key) {
|
||||||
if (key.empty()) {
|
if (key.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ namespace Resource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pack::decryptData(std::vector<uint8_t>& data, const std::string& key) { // NOLINT(readability-identifier-naming)
|
void Pack::decryptData(std::vector<uint8_t>& data, const std::string& key) {
|
||||||
// XOR is symmetric
|
// XOR is symmetric
|
||||||
encryptData(data, key);
|
encryptData(data, key);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ namespace Resource {
|
|||||||
// Add all files from a directory recursively
|
// Add all files from a directory recursively
|
||||||
auto Pack::addDirectory(const std::string& dir_path,
|
auto Pack::addDirectory(const std::string& dir_path,
|
||||||
const std::string& base_path) -> bool {
|
const std::string& base_path) -> bool {
|
||||||
namespace fs = std::filesystem; // NOLINT(readability-identifier-naming)
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
if (!fs::exists(dir_path) || !fs::is_directory(dir_path)) {
|
if (!fs::exists(dir_path) || !fs::is_directory(dir_path)) {
|
||||||
std::cerr << "ResourcePack: Directory not found: " << dir_path << '\n';
|
std::cerr << "ResourcePack: Directory not found: " << dir_path << '\n';
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class MapEditor {
|
|||||||
[[nodiscard]] auto getSelectionType() const -> EntityType { return selection_.type; }
|
[[nodiscard]] auto getSelectionType() const -> EntityType { return selection_.type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static MapEditor* instance_; // NOLINT(readability-identifier-naming) [SINGLETON] Objeto privado
|
static MapEditor* instance_;
|
||||||
|
|
||||||
MapEditor(); // Constructor
|
MapEditor(); // Constructor
|
||||||
~MapEditor(); // Destructor
|
~MapEditor(); // Destructor
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ DoorManager::DoorManager(std::string room_id, SolidActorManager* solid_actors)
|
|||||||
// Añade una puerta y la registra en el SolidActorManager. El bit
|
// Añade una puerta y la registra en el SolidActorManager. El bit
|
||||||
// BLOCKS_PLAYER del propio Door determina si bloquea al Player (se setea en
|
// BLOCKS_PLAYER del propio Door determina si bloquea al Player (se setea en
|
||||||
// el constructor si la puerta no arranca ya abierta desde el DoorTracker).
|
// el constructor si la puerta no arranca ya abierta desde el DoorTracker).
|
||||||
void DoorManager::addDoor(std::shared_ptr<Door> door) { // NOLINT(readability-identifier-naming)
|
void DoorManager::addDoor(std::shared_ptr<Door> door) {
|
||||||
solid_actors_->registerActor(door.get());
|
solid_actors_->registerActor(door.get());
|
||||||
doors_.push_back(std::move(door));
|
doors_.push_back(std::move(door));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "utils/utils.hpp" // Para checkCollision
|
#include "utils/utils.hpp" // Para checkCollision
|
||||||
|
|
||||||
// Añade un enemigo a la colección
|
// Añade un enemigo a la colección
|
||||||
void EnemyManager::addEnemy(std::shared_ptr<Enemy> enemy) { // NOLINT(readability-identifier-naming)
|
void EnemyManager::addEnemy(std::shared_ptr<Enemy> enemy) {
|
||||||
enemies_.push_back(std::move(enemy));
|
enemies_.push_back(std::move(enemy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ ItemManager::ItemManager(std::string room_id, std::shared_ptr<Scoreboard::Data>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Añade un item a la colección
|
// Añade un item a la colección
|
||||||
void ItemManager::addItem(std::shared_ptr<Item> item) { // NOLINT(readability-identifier-naming)
|
void ItemManager::addItem(std::shared_ptr<Item> item) {
|
||||||
items_.push_back(std::move(item));
|
items_.push_back(std::move(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ KeyManager::KeyManager(std::string room_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Añade una llave a la colección
|
// Añade una llave a la colección
|
||||||
void KeyManager::addKey(std::shared_ptr<Key> key) { // NOLINT(readability-identifier-naming)
|
void KeyManager::addKey(std::shared_ptr<Key> key) {
|
||||||
keys_.push_back(std::move(key));
|
keys_.push_back(std::move(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-18
@@ -798,18 +798,15 @@ auto Game::getOrCreateRoom(const std::string& room_path) -> std::shared_ptr<Room
|
|||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construye el tilemap extendido de la room actual con los bordes de las adyacentes
|
// Obtiene el collision tilemap de una room adyacente (nullptr si no existe)
|
||||||
void Game::buildCollisionBorders() {
|
auto Game::getAdjacentCollision(Room::Border border) -> const std::vector<int>* {
|
||||||
// NOLINTBEGIN(readability-identifier-naming) -- lambdas locales: se leen como llamadas a función, no son constantes.
|
auto name = room_->getRoom(border);
|
||||||
// Helper: obtiene el collision tilemap de una room adyacente (nullptr si no existe)
|
|
||||||
auto getAdjacentCollision = [&](Room::Border b) -> const std::vector<int>* {
|
|
||||||
auto name = room_->getRoom(b);
|
|
||||||
if (name == "0") { return nullptr; }
|
if (name == "0") { return nullptr; }
|
||||||
return &getOrCreateRoom(name)->getCollisionTileMap();
|
return &getOrCreateRoom(name)->getCollisionTileMap();
|
||||||
};
|
}
|
||||||
|
|
||||||
// Helper: obtiene el collision tilemap de una room diagonal (A→B o C→D)
|
// Obtiene el collision tilemap de una room diagonal (A→B o C→D)
|
||||||
auto getDiagCollision = [&](Room::Border first, Room::Border second) -> const std::vector<int>* {
|
auto Game::getDiagCollision(Room::Border first, Room::Border second) -> const std::vector<int>* {
|
||||||
// Camino 1: room en dirección 'first', luego su adyacente en dirección 'second'
|
// Camino 1: room en dirección 'first', luego su adyacente en dirección 'second'
|
||||||
auto name1 = room_->getRoom(first);
|
auto name1 = room_->getRoom(first);
|
||||||
if (name1 != "0") {
|
if (name1 != "0") {
|
||||||
@@ -825,9 +822,17 @@ void Game::buildCollisionBorders() {
|
|||||||
if (name4 != "0") { return &getOrCreateRoom(name4)->getCollisionTileMap(); }
|
if (name4 != "0") { return &getOrCreateRoom(name4)->getCollisionTileMap(); }
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
}
|
||||||
// NOLINTEND(readability-identifier-naming)
|
|
||||||
|
|
||||||
|
// SolidActorManager de la room adyacente (nullptr si no existe)
|
||||||
|
auto Game::getAdjacentSolidActors(Room::Border border) -> SolidActorManager* {
|
||||||
|
auto name = room_->getRoom(border);
|
||||||
|
if (name == "0") { return nullptr; }
|
||||||
|
return &getOrCreateRoom(name)->getSolidActors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construye el tilemap extendido de la room actual con los bordes de las adyacentes
|
||||||
|
void Game::buildCollisionBorders() {
|
||||||
CollisionMap::AdjacentData adj;
|
CollisionMap::AdjacentData adj;
|
||||||
adj.top = getAdjacentCollision(Room::Border::TOP);
|
adj.top = getAdjacentCollision(Room::Border::TOP);
|
||||||
adj.bottom = getAdjacentCollision(Room::Border::BOTTOM);
|
adj.bottom = getAdjacentCollision(Room::Border::BOTTOM);
|
||||||
@@ -845,13 +850,6 @@ void Game::buildCollisionBorders() {
|
|||||||
// que los sweeps del Player vean AABBs dinámicos (puertas, plataformas)
|
// que los sweeps del Player vean AABBs dinámicos (puertas, plataformas)
|
||||||
// de la room vecina cuando está cerca del borde, sin tener que esperar
|
// de la room vecina cuando está cerca del borde, sin tener que esperar
|
||||||
// a una transición completa de room.
|
// a una transición completa de room.
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming) -- lambda local: se lee como función, no es constante.
|
|
||||||
auto getAdjacentSolidActors = [&](Room::Border b) -> SolidActorManager* {
|
|
||||||
auto name = room_->getRoom(b);
|
|
||||||
if (name == "0") { return nullptr; }
|
|
||||||
return &getOrCreateRoom(name)->getSolidActors();
|
|
||||||
};
|
|
||||||
|
|
||||||
SolidActorManager::AdjacentActors sadj;
|
SolidActorManager::AdjacentActors sadj;
|
||||||
sadj.upper = getAdjacentSolidActors(Room::Border::TOP);
|
sadj.upper = getAdjacentSolidActors(Room::Border::TOP);
|
||||||
sadj.lower = getAdjacentSolidActors(Room::Border::BOTTOM);
|
sadj.lower = getAdjacentSolidActors(Room::Border::BOTTOM);
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ class Game {
|
|||||||
auto changeRoom(const std::string& room_path) -> bool; // Cambia de habitación
|
auto changeRoom(const std::string& room_path) -> bool; // Cambia de habitación
|
||||||
auto getOrCreateRoom(const std::string& room_path) -> std::shared_ptr<Room>; // Obtiene una habitación del caché o la crea
|
auto getOrCreateRoom(const std::string& room_path) -> std::shared_ptr<Room>; // Obtiene una habitación del caché o la crea
|
||||||
void buildCollisionBorders(); // Rellena el tilemap extendido de la room actual con bordes adyacentes
|
void buildCollisionBorders(); // Rellena el tilemap extendido de la room actual con bordes adyacentes
|
||||||
|
auto getAdjacentCollision(Room::Border border) -> const std::vector<int>*; // Collision tilemap de la room adyacente o nullptr
|
||||||
|
auto getDiagCollision(Room::Border first, Room::Border second) -> const std::vector<int>*; // Collision tilemap de la room diagonal o nullptr
|
||||||
|
auto getAdjacentSolidActors(Room::Border border) -> SolidActorManager*; // SolidActorManager de la room adyacente o nullptr
|
||||||
void updateAdjacentRooms(float delta_time); // Actualiza enemigos de las habitaciones adyacentes
|
void updateAdjacentRooms(float delta_time); // Actualiza enemigos de las habitaciones adyacentes
|
||||||
void handleInput(); // Comprueba el teclado
|
void handleInput(); // Comprueba el teclado
|
||||||
void checkPlayerIsOnBorder(); // Comprueba si el jugador esta en el borde de la pantalla y actua
|
void checkPlayerIsOnBorder(); // Comprueba si el jugador esta en el borde de la pantalla y actua
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class Color {
|
|||||||
* @param color Color del enum Cpc
|
* @param color Color del enum Cpc
|
||||||
* @return Índice de paleta (Uint8)
|
* @return Índice de paleta (Uint8)
|
||||||
*/
|
*/
|
||||||
static constexpr auto getIndex(Cpc color) -> Uint8 { // NOLINT(readability-identifier-naming)
|
static constexpr auto getIndex(Cpc color) -> Uint8 {
|
||||||
return static_cast<Uint8>(color);
|
return static_cast<Uint8>(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user