refactor: eliminar ShapeLoader::resolvePath i BASE_PATH (codi mort)

Cap caller invocava resolvePath fora de la seua pròpia definició.
A més, BASE_PATH apuntava a "data/shapes/" mentre que load() ja
construeix el path amb el prefix "shapes/" directament — el helper
mai s'hauria activat encara que es cridara.

Hallazgo #18 de CODE_REVIEW.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-20 16:37:07 +02:00
parent 9e54dde490
commit 682c27c07c
2 changed files with 56 additions and 75 deletions
-15
View File
@@ -67,19 +67,4 @@ void ShapeLoader::clearCache() {
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
if (!filename.empty() && filename[0] == '/') {
return filename;
}
// Si ya conté el prefix base_path, usar-lo directament
if (filename.starts_with(BASE_PATH)) {
return filename;
}
// Altrament, añadir base_path (ara suporta subdirectoris)
return std::string(BASE_PATH) + filename;
}
} // namespace Graphics
-4
View File
@@ -30,10 +30,6 @@ class ShapeLoader {
private:
static std::unordered_map<std::string, std::shared_ptr<Shape>> cache;
static constexpr const char* BASE_PATH = "data/shapes/";
// Helpers privats
static auto resolvePath(const std::string& filename) -> std::string;
};
} // namespace Graphics