Lint: rename públicos al inglés + refactor cognitive-complexity + unused-includes
Identifier-naming: rename de métodos públicos y cross-file al inglés
(camelBack), traducción de campos y locales en el proceso (TitleShip,
StageManager, SpawnController, ShipAnimator, helpers de PlayArea, etc.).
Refactor por cognitive-complexity (>25): GameScene::draw (59→3) con 9
helpers de estado, PhysicsWorld::resolveBodyCollisions (35→5) extrayendo
resolveBodyPair, Options::load{Window,Physics,Audio}ConfigFromYaml
(32/49/57→5/2/3) con templates readField, TitleScene::update (68→4) con
5 sub-pasos por estado + handleSkipInput/handleStartInput +
triggerExitForJoinedPlayers, DebrisManager::explode (39→3) con
extractSegments/spawnDebris/applyAngularVelocity/applyVisualRotation.
use-anyofallof: bucles → std::ranges::any_of/all_of en Input,
ShipAnimator y SpawnController.
readability-static-accessed-through-instance: Director::run y
VectorText::getTextWidth/Height invocados por clase.
readability-convert-member-functions-to-static: ResourcePack::decryptData.
unused-includes: eliminación de <utility>, <cstdint>, <vector>,
<iostream>, defaults.hpp y otros no usados directamente en headers y
unidades de traducción. Restablecido core/defaults.hpp en title_scene.cpp
(falsa "unused" del header).
Bug fix: eliminado isActive() duplicado en Bullet (redeclaración tras
rename de esta_activa→isActive que chocaba con el override de Entity).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,13 +10,12 @@
|
||||
namespace Graphics {
|
||||
|
||||
// Inicialización de variables estàtiques
|
||||
std::unordered_map<std::string, std::shared_ptr<Shape>> ShapeLoader::cache_;
|
||||
std::string ShapeLoader::base_path_ = "data/shapes/";
|
||||
std::unordered_map<std::string, std::shared_ptr<Shape>> ShapeLoader::cache;
|
||||
|
||||
auto ShapeLoader::load(const std::string& filename) -> std::shared_ptr<Shape> {
|
||||
// Check cache first
|
||||
auto it = cache_.find(filename);
|
||||
if (it != cache_.end()) {
|
||||
auto it = cache.find(filename);
|
||||
if (it != cache.end()) {
|
||||
std::cout << "[ShapeLoader] Cache hit: " << filename << '\n';
|
||||
return it->second; // Cache hit
|
||||
}
|
||||
@@ -56,17 +55,17 @@ auto ShapeLoader::load(const std::string& filename) -> std::shared_ptr<Shape> {
|
||||
std::cout << "[ShapeLoader] Carregat: " << normalized << " (" << shape->getName()
|
||||
<< ", " << shape->getNumPrimitives() << " primitives)" << '\n';
|
||||
|
||||
cache_[filename] = shape;
|
||||
cache[filename] = shape;
|
||||
return shape;
|
||||
}
|
||||
|
||||
void ShapeLoader::clear_cache() {
|
||||
std::cout << "[ShapeLoader] Netejant caché (" << cache_.size() << " formes)"
|
||||
void ShapeLoader::clearCache() {
|
||||
std::cout << "[ShapeLoader] Netejant caché (" << cache.size() << " formes)"
|
||||
<< '\n';
|
||||
cache_.clear();
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
auto ShapeLoader::get_cache_size() -> size_t { return cache_.size(); }
|
||||
auto ShapeLoader::getCacheSize() -> size_t { return cache.size(); }
|
||||
|
||||
auto ShapeLoader::resolvePath(const std::string& filename) -> std::string {
|
||||
// Si es un path absolut (comença con '/'), usar-lo directament
|
||||
@@ -75,12 +74,12 @@ auto ShapeLoader::resolvePath(const std::string& filename) -> std::string {
|
||||
}
|
||||
|
||||
// Si ya conté el prefix base_path, usar-lo directament
|
||||
if (filename.starts_with(base_path_)) {
|
||||
if (filename.starts_with(BASE_PATH)) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
// Altrament, añadir base_path (ara suporta subdirectoris)
|
||||
return base_path_ + filename;
|
||||
return std::string(BASE_PATH) + filename;
|
||||
}
|
||||
|
||||
} // namespace Graphics
|
||||
|
||||
Reference in New Issue
Block a user