mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Fit 3 resources in creature recruitmnet window
This commit is contained in:
parent
90fa1718a5
commit
f28438902a
@ -47,13 +47,23 @@ void CreatureCostBox::createItems(TResources res)
|
||||
|
||||
if(!resources.empty())
|
||||
{
|
||||
int curx = pos.w / 2 - (16 * (int)resources.size()) - (8 * ((int)resources.size() - 1));
|
||||
int curx = pos.w / 2;
|
||||
int spacing = 48;
|
||||
if (resources.size() > 2)
|
||||
{
|
||||
spacing = 32;
|
||||
curx -= (15 + 16 * ((int)resources.size() - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
curx -= ((16 * (int)resources.size()) + (8 * ((int)resources.size() - 1)));
|
||||
}
|
||||
//reverse to display gold as first resource
|
||||
for(auto & currentRes : boost::adaptors::reverse(resources))
|
||||
{
|
||||
currentRes.second.first->moveBy(Point(curx, 22));
|
||||
currentRes.second.second->moveBy(Point(curx, 22));
|
||||
curx += 48;
|
||||
curx += spacing;
|
||||
}
|
||||
}
|
||||
redraw();
|
||||
|
Loading…
x
Reference in New Issue
Block a user