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

Method SendMsgQueue

engine/Poseidon/Network/NetworkMsgContext.cpp:1416–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414
1415 return SendMsgRaw(to, rawMsg, dwFlags, level);
1416}
1417
1418DWORD NetworkComponent::SendMsgQueue(int to, NetworkMessageQueue& queue, int begin, int end, NetMsgFlags dwFlags)
1419{
1420 int n = end - begin;
1421
1422 NET_ERROR(n > 0);
1423 if (n == 1)
1424 {
1425 return SendMsgRemote(to, queue[begin].msg, queue[begin].type, dwFlags | NMFStatsAlreadyDone);
1426 }
1427
1428 NetworkMessageType type = NMTMessages;
1429 Time time = Glob.time;
1430
1431#if _ENABLE_CHEATS
1432 bool remote = !_parent->GetClient() || to != _parent->GetClient()->GetPlayer();
1433 int level = GetDiagLevel(type, remote);
1434 if (level >= 2)
1435 {
1436 DiagLogF("%s: send %d messages to %d", GetDebugName(), n, to);
1437 for (int i = begin; i < end; i++)
1438 {
1439 NetworkMessageType type = queue[i].type;
1440 int level = GetDiagLevel(type, remote);
1441 if (level < 2)
1442 continue;
1443 DiagLogF("\tMessage %s", NetworkMessageTypeNames[type]);
1444 NetworkMessageContext ctx(queue[i].msg, GetFormat(type), this, to, MSG_RECEIVE);
1445 ctx.LogMessage(level, "\t\t");
1446 }
1447 }
1448 else
1449 {
1450 for (int i = begin; i < end; i++)
1451 {
1452 NetworkMessageType type = queue[i].type;
1453 int level = GetDiagLevel(queue[i].type, remote);
1454 if (level < 2)
1455 continue;
1456 DiagLogF("%s: send message %s to %d, flags %d", GetDebugName(), NetworkMessageTypeNames[type], to, dwFlags);
1457 NetworkMessageContext ctx(queue[i].msg, GetFormat(type), this, to, MSG_RECEIVE);
1458 ctx.LogMessage(level, "\t");
1459 }
1460 }
1461
1462 if (outputLogs)
1463 LOG_DEBUG(Network, "{}: send messages to {}", GetDebugName(), to);
1464#else
1465 int level = 0;
1466#endif
1467
1468 NetworkMessageRaw rawMsg;
1469
1470 // Message header
1471 rawMsg.Put(type, NCTSmallUnsigned);
1472 rawMsg.Put(time, NCTNone);
1473

Callers

nothing calls this directly

Calls 6

GetDiagLevelFunction · 0.85
DiagLogFFunction · 0.85
GetClientMethod · 0.80
LogMessageMethod · 0.80
GetPlayerMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected