From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/server/world/chunk.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/server/world/chunk.cc (limited to 'src/server/world/chunk.cc') diff --git a/src/server/world/chunk.cc b/src/server/world/chunk.cc new file mode 100644 index 0000000..80a3da9 --- /dev/null +++ b/src/server/world/chunk.cc @@ -0,0 +1,26 @@ +#include "server/world/chunk.hh" + +namespace server { +namespace world { + +void chunk::update() noexcept { + if (!this->should_update) { + return; + } + this->packet.clear_chunk_packet(); + this->pack(packet.mutable_chunk_packet()); + this->should_update = false; +} + +void chunk::write() noexcept { + if (!this->should_write) { + return; + } + server::database::write_chunk(this->pos, this->packet.chunk_packet()); + this->should_write = false; +} + +chunk::~chunk() noexcept { this->write(); } + +} // namespace world +} // namespace server -- cgit v1.2.3