void ClientWorldComponent::setReady() { if (!connection) return; // Send ready signal BufferPointer msg = new Buffer(); msg->write8(EPT_Ready); connection->send(msg, true); }
void ClientWorldComponent::onPostUpdate() { // Send update BufferPointer update = new Buffer(); update->write8(EPT_Update); update->write32(lastupdate); update->write32(getWorld()->getTime()); // Fill buffer with updates for (unsigned int i = 0; i < entities.size(); i++) { ClientEntityComponent *component = entities[i]; if (component->hasChanged(lastacked)) { update->write16(component->getID() - 1); component->getUpdate(update.get(), lastacked); } } connection->send(update); }