refactor Content

This commit is contained in:
MihailRis
2024-06-25 22:37:53 +03:00
parent f3c5afa1ab
commit ee9f1639e9
25 changed files with 180 additions and 209 deletions
+5 -5
View File
@@ -36,7 +36,7 @@ void Lighting::clear(){
}
void Lighting::prebuildSkyLight(Chunk* chunk, const ContentIndices* indices){
auto* blockDefs = indices->getBlockDefs();
const auto* blockDefs = indices->blocks.getDefs();
int highestPoint = 0;
for (int z = 0; z < CHUNK_D; z++){
@@ -60,7 +60,7 @@ void Lighting::prebuildSkyLight(Chunk* chunk, const ContentIndices* indices){
}
void Lighting::buildSkyLight(int cx, int cz){
const Block* const* blockDefs = content->getIndices()->getBlockDefs();
const auto blockDefs = content->getIndices()->blocks.getDefs();
Chunk* chunk = chunks->getChunk(cx, cz);
for (int z = 0; z < CHUNK_D; z++){
@@ -92,8 +92,8 @@ void Lighting::onChunkLoaded(int cx, int cz, bool expand){
LightSolver* solverB = this->solverB.get();
LightSolver* solverS = this->solverS.get();
const Block* const* blockDefs = content->getIndices()->getBlockDefs();
const Chunk* chunk = chunks->getChunk(cx, cz);
auto blockDefs = content->getIndices()->blocks.getDefs();
auto chunk = chunks->getChunk(cx, cz);
for (uint y = 0; y < CHUNK_H; y++){
for (uint z = 0; z < CHUNK_D; z++){
@@ -150,7 +150,7 @@ void Lighting::onChunkLoaded(int cx, int cz, bool expand){
}
void Lighting::onBlockSet(int x, int y, int z, blockid_t id){
Block* block = content->getIndices()->getBlockDef(id);
Block* block = content->getIndices()->blocks.get(id);
solverR->remove(x,y,z);
solverG->remove(x,y,z);
solverB->remove(x,y,z);