PlayerUpdatePacket.cpp 535 B

123456789101112131415161718192021
  1. #include "common/network/toserver/PlayerUpdatePacket.h"
  2. #include "common/network/Packets.h"
  3. PlayerUpdatePacket::PlayerUpdatePacket(Entity& e) : position(e.position) {
  4. }
  5. PlayerUpdatePacket::PlayerUpdatePacket() {
  6. }
  7. void PlayerUpdatePacket::write(OutPacket& out) const {
  8. out.writeU16(Packets::C_PLAYER_UPDATE);
  9. Packets::writeVector(out, position);
  10. }
  11. bool PlayerUpdatePacket::read(InPacket& in) {
  12. return Packets::readVector(in, position);
  13. }
  14. int PlayerUpdatePacket::getSize() {
  15. return sizeof(PlayerUpdatePacket) + 2;
  16. }