game/shared/econ/econ_item_schema.cpp
bool CEconItemSchema::BInitRarities( KeyValues *pKVRarities, CUtlVector<CUtlString> *pVecErrors )
{
	// initialize the item definitions
	if ( NULL != pKVRarities )
	{
		FOR_EACH_TRUE_SUBKEY( pKVRarities, pKVRarity )
		{
			int nRarityIndex = pKVRarity->GetInt( "value" );
			int nMapIndex = m_mapRarities.Find( nRarityIndex );

			// Make sure the item index is correct because we use this index as a reference
			SCHEMA_INIT_CHECK( 
				!m_mapRarities.IsValidIndex( nMapIndex ),
				CFmtStr( "Duplicate rarity value (%d)", nRarityIndex ) );

			nMapIndex = m_mapRarities.Insert( nRarityIndex );
			SCHEMA_INIT_SUBSTEP( m_mapRarities[nMapIndex].BInitFromKV( pKVRarity, *this, pVecErrors ) );
		}
	}

	return SCHEMA_INIT_SUCCESS();
}
//-----------------------------------------------------------------------------
// Purpose:	Initializes the rarity section of the schema
//-----------------------------------------------------------------------------
Initializes the rarity section of the schema
Initializes the rarity section of the schema
bool CEconItemSchema::BInitRarities( KeyValues *pKVRarities, CUtlVector<CUtlString> *pVecErrors )
{
	if ( NULL != pKVRarities )
	{
		FOR_EACH_TRUE_SUBKEY( pKVRarities, pKVRarity )
		{
			int nRarityIndex = pKVRarity->GetInt( "value" );
			int nMapIndex = m_mapRarities.Find( nRarityIndex );
			SCHEMA_INIT_CHECK( 
				!m_mapRarities.IsValidIndex( nMapIndex ),
				CFmtStr( "Duplicate rarity value (%d)", nRarityIndex ) );
			nMapIndex = m_mapRarities.Insert( nRarityIndex );
			SCHEMA_INIT_SUBSTEP( m_mapRarities[nMapIndex].BInitFromKV( pKVRarity, *this, pVecErrors ) );
		}
	}
	return SCHEMA_INIT_SUCCESS();
}
bool CEconItemSchema :: BInitRarities ( KeyValues * pKVRarities , CUtlVector < CUtlString > * pVecErrors ) { if ( NULL != pKVRarities ) { FOR_EACH_TRUE_SUBKEY ( pKVRarities , pKVRarity ) { int nRarityIndex = pKVRarity -> GetInt ( " " ) ; int nMapIndex = m_mapRarities . Find ( nRarityIndex ) ; SCHEMA_INIT_CHECK ( ! m_mapRarities . IsValidIndex ( nMapIndex ) , CFmtStr ( " " , nRarityIndex ) ) ; nMapIndex = m_mapRarities . Insert ( nRarityIndex ) ; SCHEMA_INIT_SUBSTEP ( m_mapRarities [ nMapIndex ] . BInitFromKV ( pKVRarity , * this , pVecErrors ) ) ; } } return SCHEMA_INIT_SUCCESS ( ) ; }
Purpose:       Initializes the rarity section of the schema
Purpose : Initializes the rarity section of the schema
// initialize the item definitions // Make sure the item index is correct because we use this index as a reference