MCPcopy Create free account
hub / github.com/JACoders/OpenJK / CL_ParseServerMessage

Function CL_ParseServerMessage

code/client/cl_parse.cpp:487–538  ·  view source on GitHub ↗

===================== CL_ParseServerMessage ===================== */

Source from the content-addressed store, hash-verified

485=====================
486*/
487void CL_ParseServerMessage( msg_t *msg ) {
488 int cmd;
489
490 if ( cl_shownet->integer == 1 ) {
491 Com_Printf ("%i ",msg->cursize);
492 } else if ( cl_shownet->integer >= 2 ) {
493 Com_Printf ("------------------\n");
494 }
495
496 //
497 // parse the message
498 //
499 while ( 1 ) {
500 if ( msg->readcount > msg->cursize ) {
501 Com_Error (ERR_DROP,"CL_ParseServerMessage: read past end of server message");
502 break;
503 }
504
505 cmd = MSG_ReadByte( msg );
506
507 if ( cmd == -1 ) {
508 SHOWNET( msg, "END OF MESSAGE" );
509 break;
510 }
511
512 if ( cl_shownet->integer >= 2 ) {
513 if ( !svc_strings[cmd] ) {
514 Com_Printf( "%3i:BAD CMD %i\n", msg->readcount-1, cmd );
515 } else {
516 SHOWNET( msg, svc_strings[cmd] );
517 }
518 }
519
520 // other commands
521 switch ( cmd ) {
522 default:
523 Com_Error (ERR_DROP,"CL_ParseServerMessage: Illegible server message\n");
524 break;
525 case svc_nop:
526 break;
527 case svc_serverCommand:
528 CL_ParseCommandString( msg );
529 break;
530 case svc_gamestate:
531 CL_ParseGamestate( msg );
532 break;
533 case svc_snapshot:
534 CL_ParseSnapshot( msg );
535 break;
536 }
537 }
538}
539
540

Callers 1

CL_PacketEventFunction · 0.70

Calls 7

SHOWNETFunction · 0.70
CL_ParseCommandStringFunction · 0.70
CL_ParseGamestateFunction · 0.70
CL_ParseSnapshotFunction · 0.70
Com_PrintfFunction · 0.50
Com_ErrorFunction · 0.50
MSG_ReadByteFunction · 0.50

Tested by

no test coverage detected