浏览代码

try to plug a few coverity false positives

AlexVinS 9 年之前
父节点
当前提交
312793efd9
共有 3 个文件被更改,包括 6 次插入9 次删除
  1. 2 2
      client/widgets/CArtifactHolder.cpp
  2. 2 5
      client/windows/CCastleInterface.cpp
  3. 2 2
      client/windows/CSpellWindow.cpp

+ 2 - 2
client/widgets/CArtifactHolder.cpp

@@ -969,13 +969,13 @@ CCommanderArtPlace::CCommanderArtPlace(Point position, const CGHeroInstance * co
 
 void CCommanderArtPlace::clickLeft(tribool down, bool previousState)
 {
-	if (down && ourArt && text.size())
+	if (ourArt && text.size() && down)
 		LOCPLINT->showYesNoDialog(CGI->generaltexth->localizedTexts["commanderWindow"]["artifactMessage"].String(), [this] { returnArtToHeroCallback(); }, [] {});
 }
 
 void CCommanderArtPlace::clickRight(tribool down, bool previousState)
 {
-	if (down && ourArt && text.size())
+	if (ourArt && text.size() && down)
 		CArtPlace::clickRight(down, previousState);
 }
 

+ 2 - 5
client/windows/CCastleInterface.cpp

@@ -398,7 +398,7 @@ void CHeroGSlot::clickLeft(tribool down, bool previousState)
 
 void CHeroGSlot::clickRight(tribool down, bool previousState)
 {
-	if(down && hero)
+	if(hero && down)
 	{
 		GH.pushInt(new CInfoBoxPopup(Point(pos.x + 175, pos.y + 100), hero));
 	}
@@ -1157,7 +1157,7 @@ void CTownInfo::hover(bool on)
 
 void CTownInfo::clickRight(tribool down, bool previousState)
 {
-	if(down && building)
+	if(building && down)
 		CRClickPopup::createAndPush(CInfoWindow::genText(building->Name(), building->Description()),
 		                            new CComponent(CComponent::building, building->town->faction->index, building->bid));
 
@@ -1664,9 +1664,6 @@ void CFortScreen::RecruitArea::clickRight(tribool down, bool previousState)
 	clickLeft(down, false); //r-click does same as l-click - opens recr. window
 }
 
-
-
-
 CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem) :CWindowObject(BORDERED,imagem)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;

+ 2 - 2
client/windows/CSpellWindow.cpp

@@ -529,7 +529,7 @@ CSpellWindow::SpellArea::~SpellArea()
 
 void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 {
-	if(!down && mySpell)
+	if(mySpell && !down)
 	{
 		int spellCost = owner->myInt->cb->getSpellCost(mySpell, owner->myHero);
 		if(spellCost > owner->myHero->mana) //insufficient mana
@@ -752,7 +752,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
 
 void CSpellWindow::SpellArea::clickRight(tribool down, bool previousState)
 {
-	if(down && mySpell)
+	if(mySpell && down)
 	{
 		std::string dmgInfo;
 		int causedDmg = owner->myInt->cb->estimateSpellDamage(mySpell, owner->myHero);