diff --git a/src/frontend/gui/panels.cpp b/src/frontend/gui/panels.cpp index ebde2f86..97a211cf 100644 --- a/src/frontend/gui/panels.cpp +++ b/src/frontend/gui/panels.cpp @@ -61,7 +61,7 @@ void Container::act(float delta) { void Container::scrolled(int value) { int diff = (actualLength-size().y); if (diff > 0 && scrollable_) { - scroll += value * 20; + scroll += value * 40; if (scroll > 0) scroll = 0; if (-scroll > diff) { diff --git a/src/lighting/Lighting.cpp b/src/lighting/Lighting.cpp index 25d1a551..e15968a9 100644 --- a/src/lighting/Lighting.cpp +++ b/src/lighting/Lighting.cpp @@ -7,12 +7,11 @@ #include "../voxels/voxel.h" #include "../voxels/Block.h" #include "../constants.h" +#include "../typedefs.h" #include #include -using std::shared_ptr; - Lighting::Lighting(const Content* content, Chunks* chunks) : content(content), chunks(chunks) { auto indices = content->getIndices(); @@ -31,7 +30,7 @@ Lighting::~Lighting(){ void Lighting::clear(){ for (unsigned int index = 0; index < chunks->volume; index++){ - shared_ptr chunk = chunks->chunks[index]; + auto chunk = chunks->chunks[index]; if (chunk == nullptr) continue; Lightmap* lightmap = chunk->lightmap; @@ -98,10 +97,10 @@ void Lighting::onChunkLoaded(int cx, int cz){ const Block* const* blockDefs = content->getIndices()->getBlockDefs(); const Chunk* chunk = chunks->getChunk(cx, cz); - for (unsigned int y = 0; y < CHUNK_H; y++){ - for (unsigned int z = 0; z < CHUNK_D; z++){ - for (unsigned int x = 0; x < CHUNK_W; x++){ - voxel vox = chunk->voxels[(y * CHUNK_D + z) * CHUNK_W + x]; + for (uint y = 0; y < CHUNK_H; y++){ + for (uint z = 0; z < CHUNK_D; z++){ + for (uint x = 0; x < CHUNK_W; x++){ + voxel& vox = chunk->voxels[(y * CHUNK_D + z) * CHUNK_W + x]; const Block* block = blockDefs[vox.id]; int gx = x + cx * CHUNK_W; int gz = z + cz * CHUNK_D; diff --git a/src/logic/ChunksController.cpp b/src/logic/ChunksController.cpp index c3d28ead..49f94823 100644 --- a/src/logic/ChunksController.cpp +++ b/src/logic/ChunksController.cpp @@ -40,11 +40,11 @@ void ChunksController::update(int64_t maxDuration) { timeutil::Timer timer; if (loadVisible()) { int64_t mcs = timer.stop(); - avgDurationMcs = mcs * 0.2 + avgDurationMcs * 0.8; - if (mcstotal + max(avgDurationMcs, mcs) * 2 < maxDuration * 1000) { + if (mcstotal + mcs * 2 < maxDuration * 1000) { mcstotal += mcs; continue; } + mcstotal += mcs; } break; } @@ -74,8 +74,8 @@ bool ChunksController::loadVisible(){ if (surrounding == MIN_SURROUNDING && !chunk->isLighted()) { if (!chunk->isLoadedLights()) { lighting->buildSkyLight(chunk->x, chunk->z); - } - lighting->onChunkLoaded(chunk->x, chunk->z); + lighting->onChunkLoaded(chunk->x, chunk->z); + } chunk->setLighted(true); return true; }