-------------------------------------------------------------------------------------- Description: Find an annotation called annotationName in the map, and return its value. If not found, or it's not a bool, or map is nullptr, return defaultValue instead. Arguments: map - annotation map, may be nullptr annotationName - name of the annotation, may be nullptr defaultValue - what to return if not fo
| 1636 | // the value of this annotation, if it can be found and is of type BOOL. |
| 1637 | // ------------------------------------------------------------------------------------- |
| 1638 | bool GetBool( const Tr2EffectParameterAnnotationMap* map, const char* annotationName, bool defaultValue ) |
| 1639 | { |
| 1640 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 1641 | |
| 1642 | if( !map || !annotationName ) |
| 1643 | { |
| 1644 | return defaultValue; |
| 1645 | } |
| 1646 | |
| 1647 | auto value = std::find_if( map->begin(), map->end(), [&]( const Tr2EffectParameterAnnotation& a ) { return strcmp( a.name, annotationName ) == 0; } ); |
| 1648 | if( value != map->end() && value->type == Tr2EffectParameterAnnotation::BOOL ) |
| 1649 | { |
| 1650 | return value->boolValue; |
| 1651 | } |
| 1652 | |
| 1653 | return defaultValue; |
| 1654 | } |
| 1655 | |
| 1656 | // -------------------------------------------------------------------------------------- |
| 1657 | // Description: |
no test coverage detected