1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

[tweaks] IImage * -> auto

This commit is contained in:
AlexVinS
2018-03-30 14:29:55 +03:00
parent 43acfa160b
commit b09a54fa9c
2 changed files with 8 additions and 11 deletions

View File

@@ -1498,7 +1498,7 @@ void SelectionTab::printMaps(SDL_Surface *to)
logGlobal->warn("Warning: %s has wrong version!", currentItem->fileURI); logGlobal->warn("Warning: %s has wrong version!", currentItem->fileURI);
continue; continue;
} }
IImage * icon = formatIcons->getImage(frame,group); auto icon = formatIcons->getImage(frame,group);
if(icon) if(icon)
{ {
icon->draw(to, pos.x + 88, pos.y + 117 + line * 25); icon->draw(to, pos.x + 88, pos.y + 117 + line * 25);
@@ -2189,7 +2189,7 @@ void InfoCard::showAll(SDL_Surface * to)
for (auto i = SEL->sInfo.playerInfos.cbegin(); i != SEL->sInfo.playerInfos.cend(); i++) for (auto i = SEL->sInfo.playerInfos.cbegin(); i != SEL->sInfo.playerInfos.cend(); i++)
{ {
int *myx = ((i->first == playerColor || SEL->current->mapHeader->players[i->first.getNum()].team == myT) ? &fx : &ex); int *myx = ((i->first == playerColor || SEL->current->mapHeader->players[i->first.getNum()].team == myT) ? &fx : &ex);
IImage * flag = sFlags->getImage(i->first.getNum(),0); auto flag = sFlags->getImage(i->first.getNum(),0);
flag->draw(to, pos.x + *myx, pos.y + 399); flag->draw(to, pos.x + *myx, pos.y + 399);
*myx += flag->width(); *myx += flag->width();
flag->decreaseRef(); flag->decreaseRef();
@@ -2287,7 +2287,7 @@ void InfoCard::showTeamsPopup()
int curx = 128 - 9*flags.size(); int curx = 128 - 9*flags.size();
for(auto & flag : flags) for(auto & flag : flags)
{ {
IImage * icon = sFlags->getImage(flag,0); auto icon = sFlags->getImage(flag,0);
icon->draw(bmp, curx, 75 + 50*i); icon->draw(bmp, curx, 75 + 50*i);
icon->decreaseRef(); icon->decreaseRef();
curx += 18; curx += 18;
@@ -3517,7 +3517,7 @@ void CBonusSelection::show(SDL_Surface * to)
{ {
int *myx = ((i->first == playerColor || ourHeader->players[i->first.getNum()].team == myT) ? &fx : &ex); int *myx = ((i->first == playerColor || ourHeader->players[i->first.getNum()].team == myT) ? &fx : &ex);
IImage * flag = sFlags->getImage(i->first.getNum(),0); auto flag = sFlags->getImage(i->first.getNum(), 0);
flag->draw(to, pos.x + *myx, pos.y + 405); flag->draw(to, pos.x + *myx, pos.y + 405);
*myx += flag->width(); *myx += flag->width();
flag->decreaseRef(); flag->decreaseRef();

View File

@@ -267,13 +267,11 @@ void CAnimImage::showAll(SDL_Surface * to)
if(!visible) if(!visible)
return; return;
IImage *img;
if(flags & CShowableAnim::BASE && frame != 0) if(flags & CShowableAnim::BASE && frame != 0)
if ((img = anim->getImage(0, group))) if(auto img = anim->getImage(0, group))
img->draw(to, pos.x, pos.y); img->draw(to, pos.x, pos.y);
if ((img = anim->getImage(frame, group))) if(auto img = anim->getImage(frame, group))
img->draw(to, pos.x, pos.y); img->draw(to, pos.x, pos.y);
} }
@@ -287,8 +285,7 @@ void CAnimImage::setFrame(size_t Frame, size_t Group)
anim->load(Frame, Group); anim->load(Frame, Group);
frame = Frame; frame = Frame;
group = Group; group = Group;
IImage *img = anim->getImage(frame, group); if(auto img = anim->getImage(frame, group))
if (img)
{ {
if (flags & CShowableAnim::PLAYER_COLORED) if (flags & CShowableAnim::PLAYER_COLORED)
img->playerColored(player); img->playerColored(player);