- pack.WriteEntityCount(1);
- pack.WriteEntity(*status.entity, 0);
- Send(Packet::EntityUpdate::GetSize(1));
+ int entity_pos = 0;
+ for (SpawnStatus *status : entity_updates) {
+ pack.WriteEntity(*status->entity, entity_pos);
+ ++entity_pos;
+ if (entity_pos == Packet::EntityUpdate::MAX_ENTITIES) {
+ pack.WriteEntityCount(entity_pos);
+ Send(Packet::EntityUpdate::GetSize(entity_pos));
+ pack = Prepare<Packet::EntityUpdate>();
+ entity_pos = 0;
+ }
+ }
+ if (entity_pos > 0) {
+ pack.WriteEntityCount(entity_pos);
+ Send(Packet::EntityUpdate::GetSize(entity_pos));
+ }
+ entity_updates.clear();