mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-15 07:51:50 +00:00
replace deque with array_queue in LightSolver
This commit is contained in:
parent
99f06c9625
commit
5c64d56766
2 changed files with 28 additions and 27 deletions
|
|
@ -66,7 +66,7 @@ void LightSolver::solve(){
|
|||
};
|
||||
|
||||
while (!remqueue.empty()){
|
||||
const lightentry entry = remqueue.front();
|
||||
lightentry entry = std::move(remqueue.front());
|
||||
remqueue.pop();
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
@ -76,7 +76,9 @@ void LightSolver::solve(){
|
|||
int z = entry.z+coords[imul3+2];
|
||||
|
||||
Chunk* chunk = chunks.getChunkByVoxel(x,y,z);
|
||||
if (chunk) {
|
||||
if (chunk == nullptr) {
|
||||
continue;
|
||||
}
|
||||
int lx = x - chunk->x * CHUNK_W;
|
||||
int lz = z - chunk->z * CHUNK_D;
|
||||
chunk->flags.modified = true;
|
||||
|
|
@ -103,10 +105,9 @@ void LightSolver::solve(){
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (!addqueue.empty()){
|
||||
const lightentry entry = addqueue.front();
|
||||
lightentry entry = std::move(addqueue.front());
|
||||
addqueue.pop();
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <queue>
|
||||
#include "util/array_queue.hpp"
|
||||
|
||||
class Chunks;
|
||||
class ContentIndices;
|
||||
|
|
@ -14,8 +14,8 @@ struct lightentry {
|
|||
};
|
||||
|
||||
class LightSolver {
|
||||
std::queue<lightentry> addqueue;
|
||||
std::queue<lightentry> remqueue;
|
||||
util::array_queue<lightentry> addqueue;
|
||||
util::array_queue<lightentry> remqueue;
|
||||
const Block* const* blockDefs;
|
||||
Chunks& chunks;
|
||||
int channel;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue