diff --git a/client/renderSDL/RenderHandler.cpp b/client/renderSDL/RenderHandler.cpp index f67264745..d28bf7cbf 100644 --- a/client/renderSDL/RenderHandler.cpp +++ b/client/renderSDL/RenderHandler.cpp @@ -55,17 +55,15 @@ std::shared_ptr RenderHandler::getAnimationFile(const AnimationPath & return result; } -std::optional RenderHandler::getPath(ResourcePath path, std::string factor) +std::optional RenderHandler::getPathForScaleFactor(ResourcePath path, std::string factor) { - if(CResourceHandler::get()->existsResource(path)) - return path; if(path.getType() == EResType::IMAGE) { auto p = ImagePath::builtin(path.getName()); - if(CResourceHandler::get()->existsResource(p.addPrefix("DATA" + factor + "X/"))) - return std::optional(p.addPrefix("DATA" + factor + "X/")); if(CResourceHandler::get()->existsResource(p.addPrefix("SPRITES" + factor + "X/"))) return std::optional(p.addPrefix("SPRITES" + factor + "X/")); + if(CResourceHandler::get()->existsResource(p.addPrefix("DATA" + factor + "X/"))) + return std::optional(p.addPrefix("DATA" + factor + "X/")); } else { @@ -97,7 +95,7 @@ std::pair RenderHandler::getScalePath(ResourcePath p) ResourcePath scaledPath = ImagePath::builtin(name); if(p.getType() != EResType::IMAGE) scaledPath = AnimationPath::builtin(name); - auto tmpPath = getPath(scaledPath, std::to_string(factorToCheck)); + auto tmpPath = getPathForScaleFactor(scaledPath, std::to_string(factorToCheck)); if(tmpPath) { path = *tmpPath; diff --git a/client/renderSDL/RenderHandler.h b/client/renderSDL/RenderHandler.h index 59f70561b..7014251ed 100644 --- a/client/renderSDL/RenderHandler.h +++ b/client/renderSDL/RenderHandler.h @@ -29,7 +29,7 @@ class RenderHandler : public IRenderHandler std::map> fonts; std::shared_ptr getAnimationFile(const AnimationPath & path); - std::optional getPath(ResourcePath path, std::string factor); + std::optional getPathForScaleFactor(ResourcePath path, std::string factor); std::pair getScalePath(ResourcePath p); AnimationLayoutMap & getAnimationLayout(const AnimationPath & path); void initFromJson(AnimationLayoutMap & layout, const JsonNode & config);