MCPcopy Create free account
hub / github.com/ddnet/ddnet / SendMsg

Method SendMsg

src/engine/client/client.cpp:168–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168int CClient::SendMsg(int Conn, CMsgPacker *pMsg, int Flags)
169{
170 CNetChunk Packet;
171
172 if(State() == IClient::STATE_OFFLINE)
173 return 0;
174
175 // repack message (inefficient)
176 CPacker Pack;
177 if(!RepackMsg(pMsg, Pack, IsSixup()))
178 return 0;
179
180 mem_zero(&Packet, sizeof(CNetChunk));
181 Packet.m_ClientId = 0;
182 Packet.m_pData = Pack.Data();
183 Packet.m_DataSize = Pack.Size();
184
185 if(Flags & MSGFLAG_VITAL)
186 Packet.m_Flags |= NETSENDFLAG_VITAL;
187 if(Flags & MSGFLAG_FLUSH)
188 Packet.m_Flags |= NETSENDFLAG_FLUSH;
189
190 if((Flags & MSGFLAG_RECORD) && Conn == g_Config.m_ClDummy)
191 {
192 for(auto &i : m_aDemoRecorder)
193 if(i.IsRecording())
194 i.RecordMessage(Packet.m_pData, Packet.m_DataSize);
195 }
196
197 if(!(Flags & MSGFLAG_NOSEND))
198 {
199 m_aNetClient[Conn].Send(&Packet);
200 }
201
202 return 0;
203}
204
205int CClient::SendMsgActive(CMsgPacker *pMsg, int Flags)
206{

Callers 12

OnNewSnapshotMethod · 0.45
SendStartInfo7Method · 0.45
SendSkinChange7Method · 0.45
SendInfoMethod · 0.45
SendDummyInfoMethod · 0.45
SendKillMethod · 0.45
EmoteMethod · 0.45
SendTeamsStateMethod · 0.45
SendTuningParamsMethod · 0.45
OnSnapMethod · 0.45
SendSaveCodeMethod · 0.45
Con_PingMethod · 0.45

Calls 7

mem_zeroFunction · 0.85
RecordMessageMethod · 0.80
RepackMsgFunction · 0.70
DataMethod · 0.45
SizeMethod · 0.45
IsRecordingMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected