Collaborative edits

This commit is contained in:
2025-01-06 23:49:02 -05:00
parent 51803d37f5
commit 34a9092f59
3 changed files with 7 additions and 3 deletions

View File

@@ -288,9 +288,11 @@ namespace CaveGame::Client {
}
}
//void LocalWorld::LookForChunksNeedLoading()
void LocalWorld::LookForChunksNeedLoading()
{
// TODO: Make sure an extra layer of chunks beyond the viewport is generated.
// This will limit the amount of "pop-in" the player will notice.
@@ -307,6 +309,7 @@ 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))
RequestChunk(cell);
@@ -326,6 +329,7 @@ namespace CaveGame::Client {
check_chunks_timer = 0.f;
LookForChunksNeedUnloading();
LookForChunksNeedLoading();
//auto a1 = std::async(&LocalWorld::LookForChunksNeedLoading, this);
// TODO: Unload chunks once they're offscreen for a certain time threshold.

View File

@@ -94,7 +94,7 @@ namespace CaveGame::Core
bool HasChunkOnFile(const Vector2 &cell) const;
bool AwaitingChunkAtCell(const Vector2 &cell);
bool AwaitingChunkAtCell(const Vector2 &cell) const;
void ChunkServerThread();

View File

@@ -278,9 +278,9 @@ namespace CaveGame::Core
}
}
bool World::AwaitingChunkAtCell(const Vector2& cell)
bool World::AwaitingChunkAtCell(const Vector2& cell) const
{
int cnt = std::count(chunks_in_waiting.begin(), chunks_in_waiting.end(), cell);
int cnt = std::ranges::count(chunks_in_waiting, cell);
if (cnt > 1)
{