Skip to content

Commit

Permalink
pointlights: use std::min/max instead of their macro counterpart.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlj committed Jan 1, 2024
1 parent 3731a6c commit 19a65b5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/ivis_opengl/pielighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ PIELIGHT& LightMap::operator()(int32_t x, int32_t y)
// Give one tile worth of leeway before asserting, for units/transporters coming in from off-map.
ASSERT(x >= -1, "mapTile: x value is too small (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
ASSERT(y >= -1, "mapTile: y value is too small (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
x = MAX(x, 0);
y = MAX(y, 0);
x = std::max(x, 0);
y = std::max(y, 0);
ASSERT(x < mapWidth + 1, "mapTile: x value is too big (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
ASSERT(y < mapHeight + 1, "mapTile: y value is too big (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
x = MIN(x, mapWidth - 1);
y = MIN(y, mapHeight - 1);
x = std::min(x, mapWidth - 1);
y = std::min(y, mapHeight - 1);

return data[x + (y * mapWidth)];
}
Expand All @@ -50,12 +50,12 @@ const PIELIGHT& LightMap::operator()(int32_t x, int32_t y) const
// Give one tile worth of leeway before asserting, for units/transporters coming in from off-map.
ASSERT(x >= -1, "mapTile: x value is too small (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
ASSERT(y >= -1, "mapTile: y value is too small (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
x = MAX(x, 0);
y = MAX(y, 0);
x = std::max(x, 0);
y = std::max(y, 0);
ASSERT(x < mapWidth + 1, "mapTile: x value is too big (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
ASSERT(y < mapHeight + 1, "mapTile: y value is too big (%d,%d) in %dx%d", x, y, mapWidth, mapHeight);
x = MIN(x, mapWidth - 1);
y = MIN(y, mapHeight - 1);
x = std::min(x, mapWidth - 1);
y = std::min(y, mapHeight - 1);

return data[x + (y * mapWidth)];
}
Expand Down

0 comments on commit 19a65b5

Please sign in to comment.