1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

try to plug a few coverity false positives

This commit is contained in:
AlexVinS 2016-11-27 23:41:17 +03:00
parent 60b1a9ac52
commit 312793efd9
3 changed files with 6 additions and 9 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);