mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: optimization: PVS-Studio warning V807
Created references to avoid using repeated expressions, improving performance across multiple instances. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
52905ff27b
commit
c858913a2f
4 changed files with 18 additions and 14 deletions
|
|
@ -113,21 +113,22 @@ bool ChunksController::buildLights(const std::shared_ptr<Chunk>& chunk) {
|
|||
void ChunksController::createChunk(int x, int z) {
|
||||
auto chunk = level->chunksStorage->create(x, z);
|
||||
chunks->putChunk(chunk);
|
||||
auto& chunkFlags = chunk->flags;
|
||||
|
||||
if (!chunk->flags.loaded) {
|
||||
if (!chunkFlags.loaded) {
|
||||
generator->generate(
|
||||
chunk->voxels, x, z,
|
||||
level->getWorld()->getSeed()
|
||||
);
|
||||
chunk->flags.unsaved = true;
|
||||
chunkFlags.unsaved = true;
|
||||
}
|
||||
chunk->updateHeights();
|
||||
|
||||
if (!chunk->flags.loadedLights) {
|
||||
if (!chunkFlags.loadedLights) {
|
||||
Lighting::prebuildSkyLight(
|
||||
chunk.get(), level->content->getIndices()
|
||||
);
|
||||
}
|
||||
chunk->flags.loaded = true;
|
||||
chunk->flags.ready = true;
|
||||
chunkFlags.loaded = true;
|
||||
chunkFlags.ready = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue