mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
try to plug a few coverity false positives
This commit is contained in:
parent
9094c99759
commit
2dd6a47764
@ -2251,7 +2251,7 @@ void InfoCard::changeSelection( const CMapInfo *to )
|
||||
void InfoCard::clickRight( tribool down, bool previousState )
|
||||
{
|
||||
static const Rect flagArea(19, 397, 335, 23);
|
||||
if(down && SEL->current && isItInLoc(flagArea, GH.current->motion.x, GH.current->motion.y))
|
||||
if(SEL->current && down && SEL->current && isItInLoc(flagArea, GH.current->motion.x, GH.current->motion.y))
|
||||
showTeamsPopup();
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ void CBattleHero::clickLeft(tribool down, bool previousState)
|
||||
if(myOwner->spellDestSelectMode) //we are casting a spell
|
||||
return;
|
||||
|
||||
if(!down && myHero != nullptr && myOwner->myTurn && myOwner->getCurrentPlayerInterface()->cb->battleCanCastSpell()) //check conditions
|
||||
if(myHero != nullptr && !down && myOwner->myTurn && myOwner->getCurrentPlayerInterface()->cb->battleCanCastSpell()) //check conditions
|
||||
{
|
||||
for(int it=0; it<GameConstants::BFIELD_SIZE; ++it) //do nothing when any hex is hovered - hero's animation overlaps battlefield
|
||||
{
|
||||
|
@ -239,7 +239,7 @@ bool CHeroArtPlace::askToAssemble(const CArtifactInstance *art, ArtifactPosition
|
||||
|
||||
void CHeroArtPlace::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down && ourArt && !locked && text.size() && !picked) //if there is no description or it's a lock, do nothing ;]
|
||||
if(ourArt && down && ourArt && !locked && text.size() && !picked) //if there is no description or it's a lock, do nothing ;]
|
||||
{
|
||||
if (slotID < GameConstants::BACKPACK_START)
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ bool CGarrisonSlot::mustForceReselection() const
|
||||
|
||||
void CGarrisonSlot::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down && creature)
|
||||
if(creature && down)
|
||||
{
|
||||
GH.pushInt(new CStackWindow(myStack, true));
|
||||
}
|
||||
|
@ -134,13 +134,13 @@ CHeroArea::CHeroArea(int x, int y, const CGHeroInstance * _hero):hero(_hero)
|
||||
|
||||
void CHeroArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if((!down) && previousState && hero)
|
||||
if(hero && (!down) && previousState)
|
||||
LOCPLINT->openHeroWindow(hero);
|
||||
}
|
||||
|
||||
void CHeroArea::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if((!down) && previousState && hero)
|
||||
if(hero && (!down) && previousState)
|
||||
LOCPLINT->openHeroWindow(hero);
|
||||
}
|
||||
|
||||
@ -154,19 +154,19 @@ void CHeroArea::hover(bool on)
|
||||
|
||||
void LRClickableAreaOpenTown::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if((!down) && previousState && town)
|
||||
{
|
||||
if(town && (!down) && previousState)
|
||||
{
|
||||
LOCPLINT->openTownWindow(town);
|
||||
if ( type == 2 )
|
||||
LOCPLINT->castleInt->builds->buildingClicked(BuildingID::VILLAGE_HALL);
|
||||
else if ( type == 3 && town->fortLevel() )
|
||||
LOCPLINT->castleInt->builds->buildingClicked(BuildingID::FORT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LRClickableAreaOpenTown::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if((!down) && previousState && town)
|
||||
if(town && (!down) && previousState)
|
||||
LOCPLINT->openTownWindow(town);//TODO: popup?
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ void CBuildingRect::hover(bool on)
|
||||
|
||||
void CBuildingRect::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if( previousState && !down && area && (parent->selectedBuilding==this) && getBuilding() )
|
||||
if( previousState && getBuilding() && area && !down && (parent->selectedBuilding==this))
|
||||
if (!CSDL_Ext::isTransparent(area, GH.current->motion.x-pos.x, GH.current->motion.y-pos.y) ) //inside building image
|
||||
parent->buildingClicked(getBuilding()->bid);
|
||||
}
|
||||
|
@ -788,13 +788,13 @@ void CTavernWindow::show(SDL_Surface * to)
|
||||
|
||||
void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(previousState && !down && h)
|
||||
if(h && previousState && !down)
|
||||
*_sel = _id;
|
||||
}
|
||||
|
||||
void CTavernWindow::HeroPortrait::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down && h)
|
||||
if(h && down)
|
||||
{
|
||||
GH.pushInt(new CRClickPopupInt(new CHeroWindow(h), true));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user