MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / check_packet_usage

Method check_packet_usage

Engine/source/afx/afxChoreographer.cpp:397–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397void afxChoreographer::check_packet_usage(NetConnection* conn, BitStream* stream, S32 mark_stream_pos, const char* msg_tag)
398{
399
400 S32 packed_size = stream->getCurPos() - mark_stream_pos;
401 S32 current_headroom = stream->getMaxWriteBitNum()-(stream->getStreamSize()<<3);
402 S32 max_headroom = stream->getMaxWriteBitNum()-(conn->getMaxRatePacketSize()<<3);
403
404 if (packed_size > max_headroom)
405 {
406 Con::errorf("%s [%s] WARNING -- packed-bits (%d) > limit (%d) for max PacketSize settings. [%s]",
407 msg_tag, datablock->getName(), packed_size, max_headroom, "PACKET OVERRUN POSSIBLE");
408 Con::errorf("getMaxRatePacketSize()=%d getCurRatePacketSize()=%d", conn->getMaxRatePacketSize(), conn->getCurRatePacketSize());
409 }
410 // JTF Note: this current_headroom > 0 check is odd and occurs when object is created real early
411 // in the startup, such as when the dead orc gets fatal damage and we try to post a text effect.
412 else if (packed_size > current_headroom && current_headroom > 0)
413 {
414 Con::errorf("%s [%s] WARNING -- packed-bits (%d) > limit (%d) for current PacketSize settings. [%s]",
415 msg_tag, datablock->getName(), packed_size, current_headroom, "PACKET OVERRUN POSSIBLE");
416 }
417 else
418 {
419 F32 percentage = 100.0f*((F32)packed_size/(F32)max_headroom);
420 if (percentage >= datablock->echo_packet_usage)
421 {
422 Con::warnf("%s [%s] -- packed-bits (%d) < limit (%d). [%.1f%% full]", msg_tag, datablock->getName(),
423 packed_size, max_headroom, percentage);
424 }
425 }
426}
427
428SceneObject* afxChoreographer::get_camera(Point3F* cam_pos) const
429{

Callers

nothing calls this directly

Calls 8

getCurPosMethod · 0.80
getMaxWriteBitNumMethod · 0.80
getMaxRatePacketSizeMethod · 0.80
getCurRatePacketSizeMethod · 0.80
errorfFunction · 0.50
warnfFunction · 0.50
getStreamSizeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected