浏览代码

[tweaks] IImage * -> auto

AlexVinS 7 年之前
父节点
当前提交
b09a54fa9c
共有 2 个文件被更改,包括 8 次插入11 次删除
  1. 4 4
      client/CPreGame.cpp
  2. 4 7
      client/widgets/Images.cpp

+ 4 - 4
client/CPreGame.cpp

@@ -1498,7 +1498,7 @@ void SelectionTab::printMaps(SDL_Surface *to)
 				logGlobal->warn("Warning: %s has wrong version!", currentItem->fileURI);
 				continue;
 			}
-			IImage * icon = formatIcons->getImage(frame,group);
+			auto icon = formatIcons->getImage(frame,group);
 			if(icon)
 			{
 				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++)
 			{
 				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);
 				*myx += flag->width();
 				flag->decreaseRef();
@@ -2287,7 +2287,7 @@ void InfoCard::showTeamsPopup()
 		int curx = 128 - 9*flags.size();
 		for(auto & flag : flags)
 		{
-			IImage * icon = sFlags->getImage(flag,0);
+			auto icon = sFlags->getImage(flag,0);
 			icon->draw(bmp, curx, 75 + 50*i);
 			icon->decreaseRef();
 			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);
 
-		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);
 		*myx += flag->width();
 		flag->decreaseRef();

+ 4 - 7
client/widgets/Images.cpp

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