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

Method OnSimulate

engine/Poseidon/Network/NetworkServerSimulate.cpp:1013–1391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1011 SendMsg(info.dpid, &chat, NMFGuaranteed);
1012
1013 info.motdIndex++;
1014 if (info.motdIndex >= _motd.Size())
1015 {
1016 info.motdIndex = -1;
1017 }
1018 else
1019 {
1020 info.motdTime = Glob.uiTime + _motdInterval;
1021 }
1022 }
1023 }
1024}
1025
1026void NetworkServer::OnSimulate()
1027{
1028 // raw statistics
1029
1030 if (_dedicated)
1031 {
1032 // static DWORD lastDebugMessageTime = GlobalTickCount();
1033 DWORD now = GlobalTickCount();
1034 if (now >= _debugNext)
1035 {
1036 if (_gameMaster == AI_PLAYER || _debugInterval < 0.001)
1037 {
1038 _debugNext = INT_MAX;
1039 }
1040 else
1041 {
1042 _debugNext = _debugNext + toInt(_debugInterval * 1000);
1043 }
1044
1045 float invAge = 1 / _debugInterval;
1046
1047 if (_debugOn.FindKey(DTUserSent) >= 0)
1048 {
1049 for (int i = 0; i < _rawStatistics.Size(); i++)
1050 {
1051 BString<512> output;
1052 NetworkPlayerInfo* info = GetPlayerInfo(_rawStatistics[i].player);
1053 if (!info)
1054 {
1055 continue;
1056 }
1057 sprintf(output, "%s: sent %.0f bps (%.2f Msgps), received %.0f bps (%.2f Msgps)",
1058 (const char*)info->name, invAge * _rawStatistics[i].sizeSent * 8,
1059 invAge * _rawStatistics[i].msgSent, invAge * _rawStatistics[i].sizeReceived * 8,
1060 invAge * _rawStatistics[i].msgReceived);
1061 DebugAnswer((const char*)output);
1062 }
1063 }
1064
1065 if (_debugOn.FindKey(DTTotalSent) >= 0)
1066 {
1067 int totalMsgSent = 0;
1068 int totalMsgReceived = 0;
1069 int totalSizeSent = 0;
1070 int totalSizeReceived = 0;

Callers

nothing calls this directly

Calls 15

GlobalTickCountFunction · 0.85
sprintfFunction · 0.85
DiagLogFFunction · 0.85
FindIdentityFunction · 0.85
toLargeIntSatFunction · 0.85
saturateFunction · 0.85
IsDedicatedServerFunction · 0.85
WriteDiagOutputFunction · 0.85
LocalizeStringFunction · 0.85
GetAvgMethod · 0.80
GetSendQueueInfoMethod · 0.80
GetMinMethod · 0.80

Tested by

no test coverage detected