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

Method LogMessage

engine/Poseidon/Network/NetworkMsgContext.cpp:282–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280 }
281 }
282}
283
284void NetworkMessageContext::LogMessage(int level, RString indent) const
285{
286 DiagLogF("%sid (time = %.3f)", (const char*)indent, _msg->time.toFloat());
287 if (level < 3)
288 {
289 return;
290 }
291 int n = _format->NItems();
292 for (int i = 0; i < n; i++)
293 {
294 const NetworkMessageFormatItem& item = _format->GetItem(i);
295 const RefNetworkData& val = _msg->values[i];
296 switch (item.type)
297 {
298 case NDTBool:
299 {
300 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<bool>)
301 DiagLogF("%s%s = %s", (const char*)indent, (const char*)item.name,
302 valTyped.GetVal() ? "true" : "false");
303 }
304 break;
305 case NDTInteger:
306 {
307 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<int>)
308 DiagLogF("%s%s = %d", (const char*)indent, (const char*)item.name, valTyped.GetVal());
309 }
310 break;
311 case NDTFloat:
312 {
313 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<float>)
314 DiagLogF("%s%s = %f", (const char*)indent, (const char*)item.name, valTyped.GetVal());
315 }
316 break;
317 case NDTString:
318 {
319 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<RString>)
320 DiagLogF("%s%s = %s", (const char*)indent, (const char*)item.name, (const char*)valTyped.GetVal());
321 }
322 break;
323 case NDTRawData:
324 {
325 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<AutoArray<char>>)
326 DiagLogF("%s%s = %x, size %d", (const char*)indent, (const char*)item.name, valTyped.GetVal().Data(),
327 valTyped.GetVal().Size());
328 }
329 break;
330 case NDTTime:
331 {
332 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<Time>)
333 DiagLogF("%s%s = %.3f", (const char*)indent, (const char*)item.name, valTyped.GetVal().toFloat());
334 }
335 break;
336 case NDTVector:
337 {
338 CHECK_ASSIGN(valTyped, val, const RefNetworkDataTyped<Vector3>)
339 DiagLogF("%s%s = {%f, %f, %f}", (const char*)indent, (const char*)item.name, valTyped.GetVal().X(),

Callers 4

SendMsgRemoteMethod · 0.80
SendMsgQueueMethod · 0.80
OnMessageMethod · 0.80
OnMessageMethod · 0.80

Calls 11

DiagLogFFunction · 0.85
toFloatMethod · 0.80
RStringClass · 0.50
NItemsMethod · 0.45
GetItemMethod · 0.45
DataMethod · 0.45
SizeMethod · 0.45
XMethod · 0.45
YMethod · 0.45
ZMethod · 0.45
GetFormatMethod · 0.45

Tested by

no test coverage detected