diff options
Diffstat (limited to 'game/server/receive.cc')
| -rw-r--r-- | game/server/receive.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/game/server/receive.cc b/game/server/receive.cc index 780ae53..7674122 100644 --- a/game/server/receive.cc +++ b/game/server/receive.cc @@ -1,4 +1,5 @@ #include "server/pch.hh" + #include "server/receive.hh" #include "core/config.hh" @@ -18,11 +19,11 @@ #include "server/universe.hh" #include "server/worldgen.hh" -static void on_entity_transform_packet(const protocol::EntityTransform &packet) +static void on_entity_transform_packet(const protocol::EntityTransform& packet) { if(auto session = sessions::find(packet.peer)) { if(session->dimension && session->dimension->entities.valid(session->player_entity)) { - auto &component = session->dimension->entities.emplace_or_replace<TransformComponent>(session->player_entity); + auto& component = session->dimension->entities.emplace_or_replace<TransformComponent>(session->player_entity); component.angles = packet.angles; component.chunk = packet.chunk; component.local = packet.local; @@ -40,11 +41,11 @@ static void on_entity_transform_packet(const protocol::EntityTransform &packet) } } -static void on_entity_velocity_packet(const protocol::EntityVelocity &packet) +static void on_entity_velocity_packet(const protocol::EntityVelocity& packet) { if(auto session = sessions::find(packet.peer)) { if(session->dimension && session->dimension->entities.valid(session->player_entity)) { - auto &component = session->dimension->entities.emplace_or_replace<VelocityComponent>(session->player_entity); + auto& component = session->dimension->entities.emplace_or_replace<VelocityComponent>(session->player_entity); component.value = packet.value; protocol::EntityVelocity response; @@ -58,11 +59,11 @@ static void on_entity_velocity_packet(const protocol::EntityVelocity &packet) } } -static void on_entity_head_packet(const protocol::EntityHead &packet) +static void on_entity_head_packet(const protocol::EntityHead& packet) { if(auto session = sessions::find(packet.peer)) { if(session->dimension && session->dimension->entities.valid(session->player_entity)) { - auto &component = session->dimension->entities.emplace_or_replace<HeadComponent>(session->player_entity); + auto& component = session->dimension->entities.emplace_or_replace<HeadComponent>(session->player_entity); component.angles = packet.angles; protocol::EntityHead response; @@ -76,7 +77,7 @@ static void on_entity_head_packet(const protocol::EntityHead &packet) } } -static void on_set_voxel_packet(const protocol::SetVoxel &packet) +static void on_set_voxel_packet(const protocol::SetVoxel& packet) { if(auto session = sessions::find(packet.peer)) { if(session->dimension && !session->dimension->set_voxel(packet.voxel, packet.vpos)) { @@ -112,7 +113,7 @@ static void on_set_voxel_packet(const protocol::SetVoxel &packet) } } -static void on_request_chunk_packet(const protocol::RequestChunk &packet) +static void on_request_chunk_packet(const protocol::RequestChunk& packet) { if(auto session = sessions::find(packet.peer)) { if(!session->dimension || !session->dimension->entities.valid(session->player_entity)) { @@ -132,8 +133,7 @@ static void on_request_chunk_packet(const protocol::RequestChunk &packet) response.chunk = packet.cpos; response.voxels = chunk->get_voxels(); protocol::send(packet.peer, protocol::encode(response)); - } - else { + } else { worldgen::request_chunk(session, packet.cpos); } } @@ -141,7 +141,7 @@ static void on_request_chunk_packet(const protocol::RequestChunk &packet) } } -static void on_entity_sound_packet(const protocol::EntitySound &packet) +static void on_entity_sound_packet(const protocol::EntitySound& packet) { if(auto session = sessions::find(packet.peer)) { if(!session->dimension || !session->dimension->entities.valid(session->player_entity)) { |
