Clarify operator precedence

According to cppcheck's `clarifyCalculation` error:

```
src\game\client\components\hud.cpp:196:49: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
   float ImageSize = GameFlags & GAMEFLAG_FLAGS ? 16.0f : Split;
                                                ^
src\game\editor\layer_tiles.cpp:544:94: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    m_pTiles[y * m_Width + x].m_Flags ^= m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE ? TILEFLAG_HFLIP : TILEFLAG_VFLIP;
                                                                                             ^
src\game\editor\layer_tiles.cpp:560:94: style: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    m_pTiles[y * m_Width + x].m_Flags ^= m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE ? TILEFLAG_VFLIP : TILEFLAG_HFLIP;
                                                                                             ^
```
This commit is contained in:
Robert Müller 2022-10-30 16:17:11 +01:00
parent f46c9f9079
commit 0f2590801d
2 changed files with 3 additions and 3 deletions

View file

@ -193,7 +193,7 @@ void CHud::RenderScoreHud()
static float s_TextWidth100 = TextRender()->TextWidth(0, 14.0f, "100", -1, -1.0f);
float ScoreWidthMax = maximum(maximum(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth100);
float Split = 3.0f;
float ImageSize = GameFlags & GAMEFLAG_FLAGS ? 16.0f : Split;
float ImageSize = (GameFlags & GAMEFLAG_FLAGS) ? 16.0f : Split;
for(int t = 0; t < 2; t++)
{
// draw box

View file

@ -541,7 +541,7 @@ void CLayerTiles::BrushFlipX()
if(!Rotate && !IsRotatableTile(m_pTiles[y * m_Width + x].m_Index))
m_pTiles[y * m_Width + x].m_Flags = 0;
else
m_pTiles[y * m_Width + x].m_Flags ^= m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE ? TILEFLAG_HFLIP : TILEFLAG_VFLIP;
m_pTiles[y * m_Width + x].m_Flags ^= (m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE) ? TILEFLAG_HFLIP : TILEFLAG_VFLIP;
}
void CLayerTiles::BrushFlipY()
@ -557,7 +557,7 @@ void CLayerTiles::BrushFlipY()
if(!Rotate && !IsRotatableTile(m_pTiles[y * m_Width + x].m_Index))
m_pTiles[y * m_Width + x].m_Flags = 0;
else
m_pTiles[y * m_Width + x].m_Flags ^= m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE ? TILEFLAG_VFLIP : TILEFLAG_HFLIP;
m_pTiles[y * m_Width + x].m_Flags ^= (m_pTiles[y * m_Width + x].m_Flags & TILEFLAG_ROTATE) ? TILEFLAG_VFLIP : TILEFLAG_HFLIP;
}
void CLayerTiles::BrushRotate(float Amount)