MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / WriteNetworkId

Method WriteNetworkId

Source/Engine/Networking/NetworkManager.cpp:141–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void NetworkMessage::WriteNetworkId(const Guid& id)
142{
143#if USE_NETWORK_KEYS
144 ScopeLock lock(Keys.Lock);
145 uint32 index = MAX_uint32;
146 bool hasIndex = Keys.LookupId.TryGet(id, index);
147 if (hasIndex)
148 hasIndex &= IsNetworkKeyValid(index);
149 WriteUInt32(index);
150 if (!hasIndex)
151 {
152 // No key cached locally so send the full data
153 WriteBytes((const uint8*)&id, sizeof(Guid));
154
155 // Add to the pending list (ignore on clients as server will automatically create a key once it gets full data)
156 if (NetworkManager::Mode != NetworkManagerMode::Client &&
157 !Keys.PendingIds.ContainsKey(id))
158 {
159 Keys.PendingIds.Add(id, NetworkKey(id));
160 }
161 }
162#else
163 WriteBytes((const uint8*)&id, sizeof(Guid));
164#endif
165}
166
167void NetworkMessage::ReadNetworkId(Guid& id)
168{

Callers 6

SendInPartsFunction · 0.80
SendObjectSpawnMessageFunction · 0.80
SendObjectRoleMessageFunction · 0.80
SendDespawnFunction · 0.80
SendReplicationFunction · 0.80
SendRpcFunction · 0.80

Calls 5

IsNetworkKeyValidFunction · 0.85
NetworkKeyFunction · 0.85
TryGetMethod · 0.45
ContainsKeyMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected