MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Init

Method Init

engine/Poseidon/Network/NetworkMsg.cpp:241–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239} // namespace Poseidon::Foundation
240
241NetworkMessageFormatBase::NetworkMessageFormatBase() = default;
242
243void NetworkMessageFormatBase::Init(NetworkMessageIndices* indices)
244{
245 NET_ERROR(indices);
246 NET_ERROR(_map.NItems() == 0);
247
248 // create _map
249 int n = _items.Size();
250 for (int i = 0; i < n; i++)
251 {
252 const char* name = _items[i].name;
253
254 // avoid duplicity in names
255 const NameToIndex& check = _map[name];
256 NET_ERROR(_map.IsNull(check));
257
258 _map.Add(NameToIndex(name, i));
259 }
260
261 // scan indices
262 _indices = indices;
263 _indices->Scan(this);
264}
265

Callers 3

PrepareGameMethod · 0.45
OnMessageMethod · 0.45
DecodeMethod · 0.45

Calls 7

NameToIndexClass · 0.85
InitFunction · 0.50
NItemsMethod · 0.45
SizeMethod · 0.45
IsNullMethod · 0.45
AddMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected