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

Method OnSimulate

engine/Poseidon/Network/NetworkClient.cpp:448–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446 }
447 return NMFHighPriority;
448}
449
450void NetworkClient::SetParams(float param1, float param2)
451{
452 _param1 = param1;
453 _param2 = param2;
454
455 MissionParamsMessage msg;
456 msg._param1 = param1;
457 msg._param2 = param2;
458 SendMsg(&msg, NMFGuaranteed);
459}
460
461void NetworkClient::OnSimulate()
462{
463 // raw statistics
464#if _ENABLE_CHEATS
465 // remove statistics info
466 static AutoArray<int> texts;
467 for (int i = 0; i < texts.Size(); i++)
468 {
469 if (texts[i] >= 0)
470 GEngine->RemoveText(texts[i]);
471 }
472 texts.Resize(0);
473
474 if (outputDiags == 4)
475 {
476 NET_ERROR(_rawStatistics.Size() <= 1);
477 if (_rawStatistics.Size() > 0)
478 {
479 char output[1024];
480 snprintf(output, sizeof(output), "Server: sent %d (%d), received %d (%d)", _rawStatistics[0].sizeSent,
481 _rawStatistics[0].msgSent, _rawStatistics[0].sizeReceived, _rawStatistics[0].msgReceived);
482 texts.Add(GEngine->ShowTextF(1000, 10, 15, output));
483 }
484 }
485#endif
486
487 _connectionQuality = CQGood;
488
489#if _ENABLE_CHEATS
490 auto& input = InputSubsystem::Instance();
491 if (input.GetCheat2ToDo(SDL_SCANCODE_COMMA))
492 {
493 outputLogs = !outputLogs;
494 if (outputLogs)
495 GEngine->ShowMessage(500, "message logs on");
496 else
497 GEngine->ShowMessage(500, "message logs off");
498 }
499 if (input.GetCheat2ToDo(SDL_SCANCODE_SEMICOLON))
500 {
501 outputDiags++;
502 if (outputDiags > nOutputDiags)
503 outputDiags = 0;
504 }
505 if (input.GetCheat2ToDo(SDL_SCANCODE_APOSTROPHE))

Callers

nothing calls this directly

Calls 15

LocalizeStringFunction · 0.85
DiagLogFFunction · 0.85
ActualChatChannelFunction · 0.85
GlobalTickCountFunction · 0.85
WriteDiagOutputFunction · 0.85
RemoveTextMethod · 0.80
ShowTextFMethod · 0.80
GetCheat2ToDoMethod · 0.80
GetServerMethod · 0.80
GetLastMsgAgeMethod · 0.80
GetLastMsgAgeReportedMethod · 0.80
LastMsgAgeReportedMethod · 0.80

Tested by

no test coverage detected