1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-01 00:45:26 +02:00

Apply suggestions from code review

Co-authored-by: Andrey Filipenkov <decapitator@ukr.net>
This commit is contained in:
Nordsoft91
2022-10-08 22:55:15 +04:00
committed by GitHub
parent b6c0fcabbd
commit 23f80c58dc
15 changed files with 33 additions and 35 deletions

View File

@ -117,7 +117,7 @@ namespace BitmapHandler
return image;
}
else
{ //loading via SDL_Image
{ //loading via QImage
QImage image(QString::fromStdString(fullpath->make_preferred().string()));
if(!image.isNull())
{
@ -145,15 +145,13 @@ namespace BitmapHandler
QImage loadBitmap(const std::string & fname, bool setKey)
{
QImage image = loadBitmapFromDir("DATA/", fname, setKey);
if(image.isNull())
for(const auto dir : {"DATA/", "SPRITES/"})
{
image = loadBitmapFromDir("SPRITES/", fname, setKey);
if(image.isNull())
{
logGlobal->error("Error: Failed to find file %s", fname);
}
auto image = loadBitmapFromDir(dir, fname, setKey);
if(!image.isNull())
return image;
}
return image;
logGlobal->error("Error: Failed to find file %s", fname);
return {};
}
}