diff options
| author | untodesu <kirill@untode.su> | 2025-09-12 16:16:06 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-09-12 16:16:06 +0500 |
| commit | fc80fa024fc93dac6ea89461ef36f455c5e468a2 (patch) | |
| tree | 7c4ea8f03b6778572d59784dc28b600e3f8f2268 /game/client/session.cc | |
| parent | 12947aafcc6a6eb362cc454e2149796ec9265743 (diff) | |
| parent | 522a7514012da86f7b9643179f0763746f3b232e (diff) | |
| download | voxelius-fc80fa024fc93dac6ea89461ef36f455c5e468a2.tar.bz2 voxelius-fc80fa024fc93dac6ea89461ef36f455c5e468a2.zip | |
Merge pull request #15 from untodesu/metavoxels
Metavoxels
Diffstat (limited to 'game/client/session.cc')
| -rw-r--r-- | game/client/session.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/game/client/session.cc b/game/client/session.cc index 7e0d36c..ce3d616 100644 --- a/game/client/session.cc +++ b/game/client/session.cc @@ -6,6 +6,8 @@ #include "core/math/crc64.hh"
+#include "core/version.hh"
+
#include "shared/entity/head.hh"
#include "shared/entity/player.hh"
#include "shared/entity/transform.hh"
@@ -98,8 +100,10 @@ static void on_set_voxel_packet(const protocol::SetVoxel& packet) auto index = coord::to_index(lpos);
if(auto chunk = globals::dimension->find_chunk(cpos)) {
- if(chunk->get_voxel(index) != packet.voxel) {
- chunk->set_voxel(packet.voxel, index);
+ auto packet_voxel = world::voxel_registry::find(packet.voxel);
+
+ if(chunk->get_voxel(index) != packet_voxel) {
+ chunk->set_voxel(packet_voxel, index);
world::ChunkUpdateEvent event;
event.dimension = globals::dimension;
@@ -125,7 +129,7 @@ static void on_voxel_set(const world::VoxelSetEvent& event) // FIXME: should we also validate things here or wait for the server to do so
protocol::SetVoxel packet;
packet.vpos = coord::to_voxel(event.cpos, event.lpos);
- packet.voxel = event.voxel;
+ packet.voxel = event.voxel ? event.voxel->get_id() : NULL_VOXEL_ID;
protocol::send(session::peer, protocol::encode(packet));
}
@@ -282,11 +286,13 @@ void session::disconnect(std::string_view reason) void session::send_login_request(void)
{
protocol::LoginRequest packet;
- packet.version = protocol::VERSION;
- packet.voxel_registry_checksum = world::voxel_registry::calculate_checksum();
- packet.item_registry_checksum = world::item_registry::calculate_checksum();
+ packet.game_version_major = version::major;
+ packet.voxel_registry_checksum = world::voxel_registry::get_checksum();
+ packet.item_registry_checksum = world::item_registry::get_checksum();
packet.password_hash = server_password_hash;
packet.username = client_game::username.get();
+ packet.game_version_minor = version::minor;
+ packet.game_version_patch = version::patch;
protocol::send(session::peer, protocol::encode(packet));
|
