Const correctness

This commit is contained in:
numzero 2023-06-17 10:37:01 +03:00 committed by rubenwardy
parent 34286d77c7
commit 2f35b121a4
2 changed files with 3 additions and 3 deletions

View File

@ -617,14 +617,14 @@ void MapblockMeshGenerator::calculateCornerLevels()
cur_liquid.corner_levels[k][i] = getCornerLevel(i, k); cur_liquid.corner_levels[k][i] = getCornerLevel(i, k);
} }
f32 MapblockMeshGenerator::getCornerLevel(int i, int k) f32 MapblockMeshGenerator::getCornerLevel(int i, int k) const
{ {
float sum = 0; float sum = 0;
int count = 0; int count = 0;
int air_count = 0; int air_count = 0;
for (int dk = 0; dk < 2; dk++) for (int dk = 0; dk < 2; dk++)
for (int di = 0; di < 2; di++) { for (int di = 0; di < 2; di++) {
LiquidData::NeighborData &neighbor_data = cur_liquid.neighbors[k + dk][i + di]; const LiquidData::NeighborData &neighbor_data = cur_liquid.neighbors[k + dk][i + di];
content_t content = neighbor_data.content; content_t content = neighbor_data.content;
// If top is liquid, draw starting from top of node // If top is liquid, draw starting from top of node

View File

@ -138,7 +138,7 @@ private:
void prepareLiquidNodeDrawing(); void prepareLiquidNodeDrawing();
void getLiquidNeighborhood(); void getLiquidNeighborhood();
void calculateCornerLevels(); void calculateCornerLevels();
f32 getCornerLevel(int i, int k); f32 getCornerLevel(int i, int k) const;
void drawLiquidSides(); void drawLiquidSides();
void drawLiquidTop(); void drawLiquidTop();
void drawLiquidBottom(); void drawLiquidBottom();