1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fix some 'new' issues reported by Sonar Cloud

This commit is contained in:
Ivan Savenko
2024-05-06 15:33:30 +00:00
parent ee2cd988f4
commit 30e0a16ee9
12 changed files with 43 additions and 45 deletions

View File

@@ -49,14 +49,15 @@ void CreatureCostBox::createItems(TResources res)
{
int curx = pos.w / 2;
int spacing = 48;
int resourcesCount = static_cast<int>(resources.size());
if (resources.size() > 2)
{
spacing = 32;
curx -= (15 + 16 * ((int)resources.size() - 1));
curx -= (15 + 16 * (resourcesCount - 1));
}
else
{
curx -= ((16 * (int)resources.size()) + (8 * ((int)resources.size() - 1)));
curx -= ((16 * resourcesCount) + (8 * (resourcesCount - 1)));
}
//reverse to display gold as first resource
for(auto & currentRes : boost::adaptors::reverse(resources))