-------------------------------------------------------------------------------------- Description: This method computes a hash value for the effect based on its path name and parameters. It is not without faults: the method doen't check which parameters are actually used by the effect, doesn't do anything with values coming from a variable store. The method is not light-weight and should not be c
| 1521 | // Hash value for the effect |
| 1522 | // -------------------------------------------------------------------------------------- |
| 1523 | unsigned Tr2Effect::GetHashValue() const |
| 1524 | { |
| 1525 | unsigned hash = 0; |
| 1526 | if( m_effectResource ) |
| 1527 | { |
| 1528 | hash = CcpHashFNV1( m_effectResource->GetPath(), wcslen( m_effectResource->GetPath() ) * sizeof( wchar_t ) ); |
| 1529 | } |
| 1530 | for( auto& option : m_options ) |
| 1531 | { |
| 1532 | hash = CcpHashFNV1( &option, sizeof( option ), hash ); |
| 1533 | } |
| 1534 | for( auto it = m_constParameters.begin(); it != m_constParameters.end(); ++it ) |
| 1535 | { |
| 1536 | auto name = it->name.c_str(); |
| 1537 | // looks scary, but it's a constant string, so the pointer is unique |
| 1538 | hash = CcpHashFNV1( &name, sizeof( name ), hash ); |
| 1539 | hash = CcpHashFNV1( &it->value, sizeof( it->value ), hash ); |
| 1540 | } |
| 1541 | for( auto it = m_parameters.begin(); it != m_parameters.end(); ++it ) |
| 1542 | { |
| 1543 | hash = ( *it )->GetHashValue( hash ); |
| 1544 | } |
| 1545 | for( auto it = m_resources.begin(); it != m_resources.end(); ++it ) |
| 1546 | { |
| 1547 | hash = ( *it )->GetHashValue( hash ); |
| 1548 | } |
| 1549 | return hash; |
| 1550 | } |
| 1551 | |
| 1552 | ITriEffectParameter* Tr2Effect::FindParameterByName( const char* name ) const |
| 1553 | { |
no test coverage detected