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

Method CreateObjectsList

engine/Poseidon/Network/NetworkClientActions.cpp:2367–2464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2365 #endif
2366 */
2367 if (_connectionQuality < CQPoor)
2368 {
2369 if (latencyMS >= 500)
2370 {
2371 _connectionQuality = CQPoor;
2372 }
2373 }
2374 }
2375 int nPlayers = _identities.Size() - 1;
2376 if (nPlayers > 0)
2377 {
2378 saturate(nBytesMax, MinBandwidth / 8, MaxBandwidth / 8);
2379 }
2380
2381 nBytesMax = toInt(0.001 * GEngine->GetAvgFrameDuration() * nBytesMax);
2382
2383 nBytesMax -= nBytes;
2384 nMsgMax -= nMsg;
2385
2386#if _ENABLE_CHEATS
2387 if (outputLogs)
2388 LOG_DEBUG(Network, "Client: Limit ({}, {})", nBytesMax, nMsgMax);
2389 /*
2390 if (outputDiags == 1) sprintf(output + strlen(output), "Limit (%d, %d); ", nBytesMax, nMsgMax);
2391 */
2392#endif
2393 }
2394}
2395
2396void NetworkClient::CreateObjectsList(AutoArray<UpdateLocalObjectInfo, MemAllocSA>& objects)
2397{
2398 float maxError = 0, sumError = 0;
2399 for (int i = 0; i < _localObjects.Size(); i++)
2400 {
2401 NetworkLocalObjectInfo& oInfo = _localObjects[i];
2402
2403 for (int j = NMCUpdateFirst; j < NMCUpdateN; j++)
2404 {
2405 NetworkUpdateInfo& info = oInfo.updates[j];
2406
2407 float error;
2408 if (info.lastCreatedMsg)
2409 {
2410 // message on the way
2411 continue;
2412 }
2413 else
2414 {
2415 NetworkMessageType type = oInfo.object->GetNMType((NetworkMessageClass)j);
2416 if (type == NMTNone)
2417 {
2418 continue;
2419 }
2420
2421 if (!info.lastSentMsg)
2422 {
2423 error = FLT_MAX;
2424 }

Callers

nothing calls this directly

Calls 10

DiagLogFFunction · 0.85
saturateMaxFunction · 0.85
QSortFunction · 0.85
SetClassMethod · 0.80
SizeMethod · 0.45
GetNMTypeMethod · 0.45
CalculateErrorMethod · 0.45
GetDebugNameMethod · 0.45
AddMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected