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

Method WriteNetworkName

Source/Engine/Networking/NetworkManager.cpp:206–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206void NetworkMessage::WriteNetworkName(const StringAnsiView& name)
207{
208#if USE_NETWORK_KEYS
209 ScopeLock lock(Keys.Lock);
210 uint32 index = MAX_uint32;
211 bool hasIndex = Keys.LookupName.TryGet(name, index);
212 if (hasIndex)
213 hasIndex &= IsNetworkKeyValid(index);
214 WriteUInt32(index);
215 if (!hasIndex)
216 {
217 // No key cached locally so send the full data
218 WriteStringAnsi(name);
219
220 // Add to the pending list (ignore on clients as server will automatically create a key once it gets full data)
221 if (NetworkManager::Mode != NetworkManagerMode::Client &&
222 !Keys.PendingNames.ContainsKey(name))
223 {
224 StringAnsiView newName = CloneAllocName(name);
225 Keys.PendingNames.Add(newName, NetworkKey(newName));
226 }
227 }
228#else
229 WriteStringAnsi(name);
230#endif
231}
232
233void NetworkMessage::ReadNetworkName(StringAnsiView& name)
234{

Callers 2

SendReplicationFunction · 0.80
SendRpcFunction · 0.80

Calls 7

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

Tested by

no test coverage detected