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

Method OnMessage

src/game/server/gamecontext.cpp:2192–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2190}
2191
2192void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
2193{
2194 if(m_TeeHistorianActive)
2195 {
2196 if(m_NetObjHandler.TeeHistorianRecordMsg(MsgId))
2197 {
2198 m_TeeHistorian.RecordPlayerMessage(ClientId, pUnpacker->CompleteData(), pUnpacker->CompleteSize());
2199 }
2200 }
2201
2202 void *pRawMsg = PreProcessMsg(&MsgId, pUnpacker, ClientId);
2203
2204 if(!pRawMsg)
2205 return;
2206
2207 if(Server()->ClientIngame(ClientId))
2208 {
2209 switch(MsgId)
2210 {
2211 case NETMSGTYPE_CL_SAY:
2212 OnSayNetMessage(static_cast<CNetMsg_Cl_Say *>(pRawMsg), ClientId, pUnpacker);
2213 break;
2214 case NETMSGTYPE_CL_CALLVOTE:
2215 OnCallVoteNetMessage(static_cast<CNetMsg_Cl_CallVote *>(pRawMsg), ClientId);
2216 break;
2217 case NETMSGTYPE_CL_VOTE:
2218 OnVoteNetMessage(static_cast<CNetMsg_Cl_Vote *>(pRawMsg), ClientId);
2219 break;
2220 case NETMSGTYPE_CL_SETTEAM:
2221 OnSetTeamNetMessage(static_cast<CNetMsg_Cl_SetTeam *>(pRawMsg), ClientId);
2222 break;
2223 case NETMSGTYPE_CL_ISDDNETLEGACY:
2224 OnIsDDNetLegacyNetMessage(static_cast<CNetMsg_Cl_IsDDNetLegacy *>(pRawMsg), ClientId, pUnpacker);
2225 break;
2226 case NETMSGTYPE_CL_SHOWOTHERSLEGACY:
2227 OnShowOthersLegacyNetMessage(static_cast<CNetMsg_Cl_ShowOthersLegacy *>(pRawMsg), ClientId);
2228 break;
2229 case NETMSGTYPE_CL_SHOWOTHERS:
2230 OnShowOthersNetMessage(static_cast<CNetMsg_Cl_ShowOthers *>(pRawMsg), ClientId);
2231 break;
2232 case NETMSGTYPE_CL_SHOWDISTANCE:
2233 OnShowDistanceNetMessage(static_cast<CNetMsg_Cl_ShowDistance *>(pRawMsg), ClientId);
2234 break;
2235 case NETMSGTYPE_CL_CAMERAINFO:
2236 OnCameraInfoNetMessage(static_cast<CNetMsg_Cl_CameraInfo *>(pRawMsg), ClientId);
2237 break;
2238 case NETMSGTYPE_CL_SETSPECTATORMODE:
2239 OnSetSpectatorModeNetMessage(static_cast<CNetMsg_Cl_SetSpectatorMode *>(pRawMsg), ClientId);
2240 break;
2241 case NETMSGTYPE_CL_CHANGEINFO:
2242 OnChangeInfoNetMessage(static_cast<CNetMsg_Cl_ChangeInfo *>(pRawMsg), ClientId);
2243 break;
2244 case NETMSGTYPE_CL_EMOTICON:
2245 OnEmoticonNetMessage(static_cast<CNetMsg_Cl_Emoticon *>(pRawMsg), ClientId);
2246 break;
2247 case NETMSGTYPE_CL_KILL:
2248 OnKillNetMessage(static_cast<CNetMsg_Cl_Kill *>(pRawMsg), ClientId);
2249 break;

Callers

nothing calls this directly

Calls 5

RecordPlayerMessageMethod · 0.80
CompleteDataMethod · 0.80
CompleteSizeMethod · 0.80
ClientIngameMethod · 0.80
ServerClass · 0.50

Tested by

no test coverage detected