diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index cca557051..6359a66e7 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -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(); } diff --git a/client/battle/CBattleInterfaceClasses.cpp b/client/battle/CBattleInterfaceClasses.cpp index b1ce9b305..c99cfd769 100644 --- a/client/battle/CBattleInterfaceClasses.cpp +++ b/client/battle/CBattleInterfaceClasses.cpp @@ -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; itopenHeroWindow(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? } diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 8a5e1880a..8ab39b123 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -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); } diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index cf463e051..2dc221d33 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -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)); }