1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Army exchange implementation

This commit is contained in:
Andrii Danylchenko
2021-02-11 21:06:47 +02:00
committed by Andrii Danylchenko
parent 2ce73fd4e1
commit 8fa0b30985
2 changed files with 29 additions and 22 deletions

View File

@@ -288,10 +288,18 @@ void CAnimImage::showAll(SDL_Surface * to)
if(!visible)
return;
if(flags & CShowableAnim::BASE && frame != 0)
if(auto img = anim->getImage(0, group))
std::vector<size_t> frames = {frame};
if((flags & CShowableAnim::BASE) && frame != 0)
{
frames.insert(frames.begin(), 0);
}
for(auto targetFrame : frames)
{
if(auto img = anim->getImage(targetFrame, group))
{
if (isScaled())
if(isScaled())
{
auto scaled = img->scaleFast(float(scaledSize.x) / img->width());
scaled->draw(to, pos.x, pos.y);
@@ -299,16 +307,6 @@ void CAnimImage::showAll(SDL_Surface * to)
else
img->draw(to, pos.x, pos.y);
}
if(auto img = anim->getImage(frame, group))
{
if (isScaled())
{
auto scaled = img->scaleFast(float(scaledSize.x) / img->width());
scaled->draw(to, pos.x, pos.y);
}
else
img->draw(to, pos.x, pos.y);
}
}