================== idAsyncClient::ProcessReliableServerMessages ================== */
| 939 | ================== |
| 940 | */ |
| 941 | void idAsyncClient::ProcessReliableServerMessages( void ) { |
| 942 | idBitMsg msg; |
| 943 | byte msgBuf[MAX_MESSAGE_SIZE]; |
| 944 | byte id; |
| 945 | |
| 946 | msg.Init( msgBuf, sizeof( msgBuf ) ); |
| 947 | |
| 948 | while ( channel.GetReliableMessage( msg ) ) { |
| 949 | id = msg.ReadByte(); |
| 950 | switch( id ) { |
| 951 | case SERVER_RELIABLE_MESSAGE_CLIENTINFO: { |
| 952 | int clientNum; |
| 953 | clientNum = msg.ReadByte(); |
| 954 | |
| 955 | idDict &info = sessLocal.mapSpawnData.userInfo[ clientNum ]; |
| 956 | bool haveBase = ( msg.ReadBits( 1 ) != 0 ); |
| 957 | |
| 958 | #if ID_CLIENTINFO_TAGS |
| 959 | int checksum = info.Checksum(); |
| 960 | int srv_checksum = msg.ReadInt(); |
| 961 | if ( checksum != srv_checksum ) { |
| 962 | common->DPrintf( "SERVER_RELIABLE_MESSAGE_CLIENTINFO %d (haveBase: %s): != checksums srv: 0x%x local: 0x%x\n", clientNum, haveBase ? "true" : "false", checksum, srv_checksum ); |
| 963 | info.Print(); |
| 964 | } else { |
| 965 | common->DPrintf( "SERVER_RELIABLE_MESSAGE_CLIENTINFO %d (haveBase: %s): checksums ok 0x%x\n", clientNum, haveBase ? "true" : "false", checksum ); |
| 966 | } |
| 967 | #endif |
| 968 | |
| 969 | if ( haveBase ) { |
| 970 | msg.ReadDeltaDict( info, &info ); |
| 971 | } else { |
| 972 | msg.ReadDeltaDict( info, NULL ); |
| 973 | } |
| 974 | |
| 975 | // server forces us to a different userinfo |
| 976 | if ( clientNum == idAsyncClient::clientNum ) { |
| 977 | common->DPrintf( "local user info modified by server\n" ); |
| 978 | cvarSystem->SetCVarsFromDict( info ); |
| 979 | cvarSystem->ClearModifiedFlags( CVAR_USERINFO ); // don't emit back |
| 980 | } |
| 981 | game->SetUserInfo( clientNum, info, true, false ); |
| 982 | break; |
| 983 | } |
| 984 | case SERVER_RELIABLE_MESSAGE_SYNCEDCVARS: { |
| 985 | idDict &info = sessLocal.mapSpawnData.syncedCVars; |
| 986 | msg.ReadDeltaDict( info, &info ); |
| 987 | cvarSystem->SetCVarsFromDict( info ); |
| 988 | if ( !idAsyncNetwork::allowCheats.GetBool() ) { |
| 989 | cvarSystem->ResetFlaggedVariables( CVAR_CHEAT ); |
| 990 | } |
| 991 | break; |
| 992 | } |
| 993 | case SERVER_RELIABLE_MESSAGE_PRINT: { |
| 994 | char string[MAX_STRING_CHARS]; |
| 995 | msg.ReadString( string, MAX_STRING_CHARS ); |
| 996 | common->Printf( "%s\n", string ); |
| 997 | break; |
| 998 | } |
nothing calls this directly
no test coverage detected