refactor(world): rework chunk state machine and player chunk tracking

Introduce ChunkState enum and ChunkEntity struct to manage chunk lifecycle. Store chunks as shared_ptr to avoid move operations during generation. Add clear_unused_chunks to remove chunks not referenced by any player. Implement deferred chunk request queue for safe processing after generation completes. Update player chunk set during required chunk computation. Improve thread safety with mutexes on chunk and player maps. Fix m_gening flag not reset after generation and add assertions for correctness. Change need_gen to require a player UUID, removing std::optional. Add chunk_size query method for debugging.
This commit is contained in:
2026-06-28 14:27:30 +08:00
parent e1e9efb86c
commit 28b66ee275
8 changed files with 280 additions and 113 deletions

View File

@@ -123,6 +123,9 @@ target_link_libraries(${PROJECT_NAME}
protobuf::libprotobuf
absl::log
absl::check
absl::base
absl::strings
absl::flat_hash_map
zstd::zstd
$<$<PLATFORM_ID:Windows>:ws2_32>