12345678910111213141516171819202122232425262728 |
- #include "common/network/toclient/EntityUpdatePacket.h"
- #include "common/network/Packets.h"
- EntityUpdatePacket::EntityUpdatePacket(const Entity& e)
- : lengthAngle(e.lengthAngle), widthAngle(e.widthAngle),
- position(e.position), velocity(e.velocity) {
- }
- EntityUpdatePacket::EntityUpdatePacket() {
- }
- void EntityUpdatePacket::write(OutPacket& out) const {
- out.writeU16(Packets::S_ENTITY_UPDATE);
- out.writeFloat(lengthAngle);
- out.writeFloat(widthAngle);
- Packets::writeVector(out, position);
- Packets::writeVector(out, velocity);
- }
- bool EntityUpdatePacket::read(InPacket& in) {
- return in.readFloat(lengthAngle) || in.readFloat(widthAngle) ||
- Packets::readVector(in, position) ||
- Packets::readVector(in, velocity);
- }
- int EntityUpdatePacket::getSize() {
- return sizeof(EntityUpdatePacket) + 2;
- }
|