MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / OnMessage

Method OnMessage

ogsr_engine/xrGame/xrServer.cpp:371–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369
370extern float g_fCatchObjectTime;
371u32 xrServer::OnMessage(NET_Packet& P, ClientID sender) // Non-Zero means broadcasting with "flags" as returned
372{
373 u16 type;
374 P.r_begin(type);
375
376 csPlayers.Enter();
377
378 VERIFY(verify_entities());
379 xrClientData* CL = ID_to_client(sender);
380
381 switch (type)
382 {
383 case M_UPDATE: {
384 Process_update(P, sender); // No broadcast
385 VERIFY(verify_entities());
386 }
387 break;
388 case M_SPAWN: {
389 if (CL->flags.bLocal)
390 Process_spawn(P, sender);
391
392 VERIFY(verify_entities());
393 }
394 break;
395 case M_EVENT: {
396 Process_event(P, sender);
397 VERIFY(verify_entities());
398 }
399 break;
400 case M_EVENT_PACK: {
401 NET_Packet tmpP;
402 while (!P.r_eof())
403 {
404 tmpP.B.count = P.r_u8();
405 P.r(&tmpP.B.data, tmpP.B.count);
406
407 OnMessage(tmpP, sender);
408 }
409 }
410 break;
411 case M_CLIENTREADY: {
412 xrClientData* CL = ID_to_client(sender);
413 if (CL)
414 {
415 CL->net_Ready = TRUE;
416 CL->ps->DeathTime = Device.dwTimeGlobal;
417 CL->ps->setName(CL->name.c_str());
418 };
419 game->signal_Syncronize();
420 VERIFY(verify_entities());
421 }
422 break;
423 case M_SWITCH_DISTANCE: {
424 game->switch_distance(P, sender);
425 VERIFY(verify_entities());
426 }
427 break;
428 case M_CHANGE_LEVEL: {

Callers 2

SendTo_LLMethod · 0.45
SendMethod · 0.45

Calls 15

net_flagsFunction · 0.85
r_eofMethod · 0.80
signal_SyncronizeMethod · 0.80
AddDelayedEventMethod · 0.80
LeaveMethod · 0.80
r_beginMethod · 0.45
EnterMethod · 0.45
r_u8Method · 0.45
rMethod · 0.45
setNameMethod · 0.45
c_strMethod · 0.45
switch_distanceMethod · 0.45

Tested by

no test coverage detected