Пример #1
0
//-----------------------------------------------------------------------------
// Purpose: Our stats data was stored!
//-----------------------------------------------------------------------------
void CStatsAndAchievements::OnUserStatsStored( UserStatsStored_t *pCallback )
{
	// we may get callbacks for other games' stats arriving, ignore them
	if ( m_GameID.ToUint64() == pCallback->m_nGameID )
	{
		if ( k_EResultOK == pCallback->m_eResult )
		{
			OutputDebugString( "StoreStats - success\n" );
			SaveUserStatsOnPS3();
		}
		else if ( k_EResultInvalidParam == pCallback->m_eResult )
		{
			// One or more stats we set broke a constraint. They've been reverted,
			// and we should re-iterate the values now to keep in sync.
			OutputDebugString( "StoreStats - some failed to validate\n" );
			// Fake up a callback here so that we re-load the values.
			UserStatsReceived_t callback;
			callback.m_eResult = k_EResultOK;
			callback.m_nGameID = m_GameID.ToUint64();
			OnUserStatsReceived( &callback );
		}
		else
		{
			char buffer[128];
			sprintf_safe( buffer, "StoreStats - failed, %d\n", pCallback->m_eResult );
			buffer[ sizeof(buffer) - 1 ] = 0;
			OutputDebugString( buffer );
		}
	}
}
Пример #2
0
void CSteamStats::OnUserStatsStored( UserStatsStored_t *pCallback )
{
 // we may get callbacks for other games' stats arriving, ignore them
 if ( m_iAppID == pCallback->m_nGameID )
 {
   if ( k_EResultOK == pCallback->m_eResult )
   {
     sysLogPrintDebug("[STEAM stats] StoreStats - success\n" );
   }
   else if ( k_EResultInvalidParam == pCallback->m_eResult )
   {
     // One or more stats we set broke a constraint. They've been reverted,
     // and we should re-iterate the values now to keep in sync.
     sysLogPrintDebug("[STEAM stats] StoreStats - some failed to validate\n" );
     // Fake up a callback here so that we re-load the values.
     UserStatsReceived_t callback;
     callback.m_eResult = k_EResultOK;
     callback.m_nGameID = m_iAppID;
     OnUserStatsReceived( &callback );
   }
   else
   {
     char buffer[128];
     _snprintf( buffer, 128, "StoreStats - failed, %d\n", pCallback->m_eResult );
     sysLogPrintDebug("[STEAM stats] %s", buffer );
   }
 }
}