// // read_network_attributes // void ClientSidePrediction::read_network_attributes(Serializable& object, Deserializer& source) { const auto attributes = object.GetNetworkAttributes(); if (!attributes) return; unsigned numAttributes = attributes->Size(); for (unsigned i = 0; i < numAttributes && !source.IsEof(); ++i) { const auto& attr = attributes->At(i); object.OnSetAttribute(attr, source.ReadVariant(attr.type_)); } }
// // write_network_attributes // void ClientSidePrediction::write_network_attributes(Serializable& object, Serializer& dest) { const auto attributes = object.GetNetworkAttributes(); if (!attributes) return; auto numAttributes = attributes->Size(); Variant value; for (unsigned i = 0; i < numAttributes; ++i) { const auto& attr = attributes->At(i); value.Clear(); object.OnGetAttribute(attr, value); dest.WriteVariantData(value); } }