===================== CL_ParseServerMessage ===================== */
| 485 | ===================== |
| 486 | */ |
| 487 | void 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 |
no test coverage detected