aboutsummaryrefslogtreecommitdiff
path: root/src/server/world/chunk.cc
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
commite4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch)
treeed58c3c246e3af1af337697695d780aa31f6ad9a /src/server/world/chunk.cc
parent1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff)
Update to most recent version (old initial commit)
Diffstat (limited to 'src/server/world/chunk.cc')
-rw-r--r--src/server/world/chunk.cc26
1 files changed, 26 insertions, 0 deletions
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