/*
========================
idSnapShot::ApplyToExistingState
Take uncompressed state in msg and add it to existing state
========================
*/
void idSnapShot::ApplyToExistingState( int objId, idBitMsg& msg )
{
	objectState_t* 	objectState = FindObjectByID( objId );
	if( !verify( objectState != NULL ) )
	{
		return;
	}
	
	if( !objectState->createdFromTemplate )
	{
		// We were created this from a template, so we shouldn't be applying it again
		if( net_ssTemplateDebug.GetBool() )
		{
			idLib::Printf( "NOT ApplyToExistingState[%d] because object was created from existing base state. %d\n", objId, objectState->expectedSequence );
			objectState->Print( "SS STATE" );
		}
		return;
	}
	
	// Debug print the template (spawn) and delta state
	if( net_ssTemplateDebug.GetBool() )
	{
		idLib::Printf( "\nApplyToExistingState[%d]. buffer size: %d msg size: %d\n", objId, objectState->buffer.Size(), msg.GetSize() );
		objectState->Print( "DELTA STATE" );
		
		PrintAlign( "SPAWN STATE" );
		for( int i = 0; i < msg.GetSize(); i++ )
		{
			if( InDebugRange( i ) )
			{
				idLib::Printf( "%02X", msg.GetReadData()[i] );
			}
		}
		idLib::Printf( "\n" );
	}
	
	// Actually apply it
	for( objectSize_t i = 0; i < Min( objectState->buffer.Size(), msg.GetSize() ); i++ )
	{
		objectState->buffer[i] += msg.GetReadData()[i];
	}
	
	// Debug print the final state
	if( net_ssTemplateDebug.GetBool() )
	{
		objectState->Print( "NEW STATE" );
		idLib::Printf( "\n" );
	}
}
Exemple #2
0
/*
============
sdGUIDFile::ListBans
============
*/
void sdGUIDFile::ListBans( const idBitMsg& msg ) {
	while ( msg.GetSize() != msg.GetReadCount() ) {
		int index = msg.ReadLong();
		char buffer[ 128 ];
		msg.ReadString( buffer, sizeof( buffer ) );
		gameLocal.Printf( "%d: %s\n", index, buffer );
	}
}
/*
========================
idLobby::UpdateSessionUserOnPeers
========================
*/
void idLobby::UpdateSessionUserOnPeers( idBitMsg & msg ) {
	for ( int p = 0; p < peers.Num(); p++ ) {
		QueueReliableMessage( p, RELIABLE_UPDATE_SESSION_USER, msg.GetReadData() + msg.GetReadCount(), msg.GetSize() - msg.GetReadCount() );
	}

	HandleUpdateSessionUser( msg );
}