Update LocalWorld.cpp

Found & fixed a memory error that would repeatedly cause a chunk that has already been generated to be requested again.
This commit is contained in:
2025-01-18 15:10:01 -05:00
parent a0c0ccdf5e
commit 86e00e7b35

View File

@@ -304,9 +304,6 @@ namespace CaveGame::Client {
//void LocalWorld::LookForChunksNeedLoading()
void LocalWorld::LookForChunksNeedLoading()
{
// TODO If you want to load chunks the player cannot see, Update the "LookForChunksNeedUnloading" function to use the same bounds.
// The chunks just outside the visible area would be written to the disk and reloaded every time the loop went around - Redacted.
Vector2 viewport_topleft = camera.ScaledViewportOversized(2*Core::Chunk::ChunkSize).minPoint;
Vector2 viewport_bottomright = camera.ScaledViewportOversized(2*Core::Chunk::ChunkSize).maxPoint;
@@ -320,9 +317,8 @@ namespace CaveGame::Client {
{
for (int y = lower_bound_v; y <= upper_bound_v; y++)
{
//Logs::Debug("dickballs");
Vector2 cell = Vector2(x,y);
if (!HasChunkAtCell(cell) || !AwaitingChunkAtCell(cell))
Vector2 cell(x, y);
if (!HasChunkAtCell(cell) && !AwaitingChunkAtCell(cell))
RequestChunk(cell);
}
}