Use constexpr where applicable in Viewport.cpp

This commit is contained in:
ζeh Matt 2021-08-26 22:48:16 +03:00
parent 04ba3f92d7
commit 5bf882587a
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 6 additions and 1 deletions

View File

@ -239,7 +239,12 @@ CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords)
auto max = GetMapSizeMinus2();
if (pos.x > max && pos.y > max)
{
const CoordsXY corr[] = { { -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 1 } };
static constexpr CoordsXY corr[] = {
{ -1, -1 },
{ 1, -1 },
{ 1, 1 },
{ -1, 1 },
};
pos.x += corr[rotation].x * height;
pos.y += corr[rotation].y * height;
}