]> git.localhorst.tv Git - blank.git/blobdiff - src/net/net.cpp
fix EntityUpdate packet length
[blank.git] / src / net / net.cpp
index 0f8aa216c42f8c57b1fcfb667ac75216610b7976..fa9c381f15d4961dbf9ae6578c101e408fe99dfd 100644 (file)
@@ -351,18 +351,19 @@ void Packet::EntityUpdate::ReadEntityCount(uint32_t &count) const noexcept {
 }
 
 void Packet::EntityUpdate::WriteEntity(const Entity &entity, uint32_t num) noexcept {
-       uint32_t off = 4 + (num * 64);
+       uint32_t off = GetSize(num);;
 
        Write(entity.ID(), off);
        Write(entity.GetState(), off + 4);
 }
 
 void Packet::EntityUpdate::ReadEntityID(uint32_t &id, uint32_t num) const noexcept {
-       Read(id, 4 + (num * 64));
+       uint32_t off = GetSize(num);;
+       Read(id, off);
 }
 
 void Packet::EntityUpdate::ReadEntityState(EntityState &state, uint32_t num) const noexcept {
-       uint32_t off = 4 + (num * 64);
+       uint32_t off = GetSize(num);;
        Read(state, off + 4);
 }