From e9076f22fe2a49d1cd8933e54b7b00c5dd943269 Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 12 Sep 2025 13:33:52 +0500 Subject: It compiles --- game/client/session.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'game/client/session.cc') diff --git a/game/client/session.cc b/game/client/session.cc index 7e0d36c..c33b4d9 100644 --- a/game/client/session.cc +++ b/game/client/session.cc @@ -98,8 +98,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 +127,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->get_id(); protocol::send(session::peer, protocol::encode(packet)); } @@ -283,7 +285,7 @@ void session::send_login_request(void) { protocol::LoginRequest packet; packet.version = protocol::VERSION; - packet.voxel_registry_checksum = world::voxel_registry::calculate_checksum(); + packet.voxel_registry_checksum = world::voxel_registry::get_checksum(); packet.item_registry_checksum = world::item_registry::calculate_checksum(); packet.password_hash = server_password_hash; packet.username = client_game::username.get(); -- cgit From 73cbcdd6e8c849e32abbf9757e603e6a6654e870 Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 12 Sep 2025 14:09:34 +0500 Subject: Metaitems --- game/client/session.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'game/client/session.cc') diff --git a/game/client/session.cc b/game/client/session.cc index c33b4d9..907b789 100644 --- a/game/client/session.cc +++ b/game/client/session.cc @@ -127,7 +127,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->get_id(); + packet.voxel = event.voxel ? event.voxel->get_id() : NULL_VOXEL_ID; protocol::send(session::peer, protocol::encode(packet)); } @@ -286,7 +286,7 @@ void session::send_login_request(void) protocol::LoginRequest packet; packet.version = protocol::VERSION; packet.voxel_registry_checksum = world::voxel_registry::get_checksum(); - packet.item_registry_checksum = world::item_registry::calculate_checksum(); + packet.item_registry_checksum = world::item_registry::get_checksum(); packet.password_hash = server_password_hash; packet.username = client_game::username.get(); -- cgit From 522a7514012da86f7b9643179f0763746f3b232e Mon Sep 17 00:00:00 2001 From: untodesu Date: Fri, 12 Sep 2025 16:15:32 +0500 Subject: Protocol and versioning changes --- game/client/session.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'game/client/session.cc') diff --git a/game/client/session.cc b/game/client/session.cc index 907b789..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" @@ -284,11 +286,13 @@ void session::disconnect(std::string_view reason) void session::send_login_request(void) { protocol::LoginRequest packet; - packet.version = protocol::VERSION; + 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)); -- cgit