From 4ddc43a369dd170ab10144e2412969ebeb34ea2c Mon Sep 17 00:00:00 2001 From: alyokhin Date: Tue, 5 Dec 2023 19:52:28 +0300 Subject: [PATCH] fix indents --- src/include/viewport.h | 13 ++++----- src/map/map_draw.cpp | 66 +++++++++++++++++++++--------------------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/include/viewport.h b/src/include/viewport.h index 16277fed1b..b716ded7f0 100644 --- a/src/include/viewport.h +++ b/src/include/viewport.h @@ -135,13 +135,12 @@ class CViewport void Set(const PixelPos &mapPixelPos); /// Draw the map grid for dubug purposes void DrawMapGridInViewport() const; - /// Highlight overlays when size of logical and graphical tiles are identical - void HighlightGraphicalTileInViewport(int dx, int dy, uint32_t color = ColorRed, uint8_t transparency = 64) const; - /// Highlight overlays when size of logical and graphical tiles are differ - void HighlightGraphicalTileInViewport(int dx, int dy, int graphicTileOffset, int sx, - const fieldHighlightChecker highlightChecker, - uint32_t color = ColorRed, uint8_t transparency = 64) const; - + /// Highlight overlays when size of logical and graphical tiles are identical + void HighlightGraphicalTileInViewport(int dx, int dy, uint32_t color = ColorRed, uint8_t transparency = 64) const; + /// Highlight overlays when size of logical and graphical tiles are differ + void HighlightGraphicalTileInViewport(int dx, int dy, int graphicTileOffset, int sx, + const fieldHighlightChecker highlightChecker, + uint32_t color = ColorRed, uint8_t transparency = 64) const; /** Draw the map background. * The template parameter graphicalTileIsLogicalTile selects the specialization. * Drawing maps where graphical and logical tile sizes differ implies some extra diff --git a/src/map/map_draw.cpp b/src/map/map_draw.cpp index d276c57652..4b518e4d3a 100644 --- a/src/map/map_draw.cpp +++ b/src/map/map_draw.cpp @@ -260,21 +260,21 @@ void CViewport::DrawMapGridInViewport() const /// Highlight overlays when size of logical and graphical tiles are identical void CViewport::HighlightGraphicalTileInViewport(int dx, int dy, uint32_t color /* = ColorRed */, uint8_t transparency /* = 64*/) const { - Video.FillTransRectangleClip(color, dx, dy, PixelTileSize.x, PixelTileSize.y, transparency); + Video.FillTransRectangleClip(color, dx, dy, PixelTileSize.x, PixelTileSize.y, transparency); } /// Highlight overlays when size of logical and graphical tiles are differ void CViewport::HighlightGraphicalTileInViewport(int dx, int dy, int graphicTileOffset, int sx, - const fieldHighlightChecker highlightChecker, - uint32_t color /* = ColorRed */, uint8_t transparency /* = 64*/) const + const fieldHighlightChecker highlightChecker, + uint32_t color /* = ColorRed */, uint8_t transparency /* = 64*/) const { - for (int i = 0; i < graphicTileOffset; i++) { - for (int j = 0; j < graphicTileOffset; j++) { - if (highlightChecker(Map.Fields[sx + j + (Map.Info.MapWidth * i)])) { - Video.FillTransRectangleClip(color, dx + j * PixelTileSize.x, dy + i * PixelTileSize.y, PixelTileSize.x, PixelTileSize.y, transparency); - } - } - } + for (int i = 0; i < graphicTileOffset; i++) { + for (int j = 0; j < graphicTileOffset; j++) { + if (highlightChecker(Map.Fields[sx + j + (Map.Info.MapWidth * i)])) { + Video.FillTransRectangleClip(color, dx + j * PixelTileSize.x, dy + i * PixelTileSize.y, PixelTileSize.x, PixelTileSize.y, transparency); + } + } + } } template @@ -348,30 +348,30 @@ void CViewport::DrawMapBackgroundInViewport(const fieldHighlightChecker highligh } Map.TileGraphic->DrawFrameClip(tile, dx, dy); #ifdef DEBUG - // AStar passability overlay - if (CViewport::isPassabilityHighlighted()) { - - HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, - [](const CMapField &mf) -> bool { return mf.getFlag() & MapFieldUnpassable; }, - ColorRed, 32); - HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, - [](const CMapField &mf) -> bool { return !(mf.getFlag() & MapFieldUnpassable); }, - ColorGreen, 32); - HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, - [](const CMapField &mf) -> bool { return mf.getFlag() & (MapFieldLandUnit | MapFieldBuilding | MapFieldSeaUnit); }, - ColorOrange, 32); - } + // AStar passability overlay + if (CViewport::isPassabilityHighlighted()) { + + HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, + [](const CMapField &mf) -> bool { return mf.getFlag() & MapFieldUnpassable; }, + ColorRed, 32); + HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, + [](const CMapField &mf) -> bool { return !(mf.getFlag() & MapFieldUnpassable); }, + ColorGreen, 32); + HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, + [](const CMapField &mf) -> bool { return mf.getFlag() & (MapFieldLandUnit | MapFieldBuilding | MapFieldSeaUnit); }, + ColorOrange, 32); + } #endif - /// Highlight overlay if needed (editor stuff) - if (highlightChecker) { - if constexpr(graphicalTileIsLogicalTile) { - if(highlightChecker(mf)) { - HighlightGraphicalTileInViewport(dx, dy); - } - } else { - HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, highlightChecker); - } - } + /// Highlight overlay if needed (editor stuff) + if (highlightChecker) { + if constexpr(graphicalTileIsLogicalTile) { + if(highlightChecker(mf)) { + HighlightGraphicalTileInViewport(dx, dy); + } + } else { + HighlightGraphicalTileInViewport(dx, dy, graphicTileOffset, sx, highlightChecker); + } + } if constexpr(graphicalTileIsLogicalTile) { ++sx; } else {