X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2Fnet.cpp;h=4d364124253d9e5d5e5668e77a6ec52ef29eb9b0;hb=4e3d9c23940c4511623b5bf328cbbe42641c4b30;hp=852efd3a419f2075ebd4b2878ff17216ce61e36c;hpb=37e056bafe9603981d6bcb205e1472e063c94700;p=blank.git diff --git a/src/net/net.cpp b/src/net/net.cpp index 852efd3..4d36412 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -282,8 +282,7 @@ void Packet::Login::ReadPlayerName(string &name) const noexcept { } void Packet::Join::WritePlayer(const Entity &player) noexcept { - // TODO: generate entity IDs - Write(uint32_t(1), 0); + Write(player.ID(), 0); Write(player.ChunkCoords(), 4); Write(player.Position(), 16); Write(player.Velocity(), 28); @@ -291,15 +290,17 @@ void Packet::Join::WritePlayer(const Entity &player) noexcept { Write(player.AngularVelocity(), 56); } +void Packet::Join::ReadPlayerID(uint32_t &id) const noexcept { + Read(id, 0); +} + void Packet::Join::ReadPlayer(Entity &player) const noexcept { - uint32_t id = 0; glm::ivec3 chunk_coords(0); glm::vec3 pos; glm::vec3 vel; glm::quat rot; glm::vec3 ang; - Read(id, 0); Read(chunk_coords, 4); Read(pos, 16); Read(vel, 28);