mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Valve container fixups
* Fix missing "HasElement" method in CUtlRBTree. * Change iterator types to "unsigned short" to avoid compiler warnings (default template argument for the index type is unsigned short).
This commit is contained in:
parent
cfa2172322
commit
59a3f50c00
@ -24,11 +24,11 @@
|
||||
|
||||
// This is a useful macro to iterate from start to end in order in a map
|
||||
#define FOR_EACH_MAP( mapName, iteratorName ) \
|
||||
for ( int iteratorName = (mapName).FirstInorder(); (mapName).IsUtlMap && iteratorName != (mapName).InvalidIndex(); iteratorName = (mapName).NextInorder( iteratorName ) )
|
||||
for ( unsigned short iteratorName = (mapName).FirstInorder(); (mapName).IsUtlMap && iteratorName != (mapName).InvalidIndex(); iteratorName = (mapName).NextInorder( iteratorName ) )
|
||||
|
||||
// faster iteration, but in an unspecified order
|
||||
#define FOR_EACH_MAP_FAST( mapName, iteratorName ) \
|
||||
for ( int iteratorName = 0; (mapName).IsUtlMap && iteratorName < (mapName).MaxElement(); ++iteratorName ) if ( !(mapName).IsValidIndex( iteratorName ) ) continue; else
|
||||
for ( unsigned short iteratorName = 0; (mapName).IsUtlMap && iteratorName < (mapName).MaxElement(); ++iteratorName ) if ( !(mapName).IsValidIndex( iteratorName ) ) continue; else
|
||||
|
||||
|
||||
struct base_utlmap_t
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
|
||||
// This is a useful macro to iterate from start to end in order in a map
|
||||
#define FOR_EACH_UTLRBTREE( treeName, iteratorName ) \
|
||||
for ( int iteratorName = treeName.FirstInorder(); iteratorName != treeName.InvalidIndex(); iteratorName = treeName.NextInorder( iteratorName ) )
|
||||
#define FOR_EACH_RBTREE( treeName, iteratorName ) \
|
||||
for ( unsigned short iteratorName = treeName.FirstInorder(); iteratorName != treeName.InvalidIndex(); iteratorName = treeName.NextInorder( iteratorName ) )
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -219,6 +219,7 @@ public:
|
||||
I InsertIfNotFound(T const& insert);
|
||||
|
||||
// Find method
|
||||
bool HasElement(T const& search) const;
|
||||
I Find(T const& search) const;
|
||||
|
||||
// Remove methods
|
||||
@ -1549,6 +1550,14 @@ I CUtlRBTree<T, I, L, M>::InsertIfNotFound(T const& insert)
|
||||
}
|
||||
|
||||
|
||||
template < class T, class I, typename L, class M >
|
||||
bool CUtlRBTree<T, I, L, M>::HasElement(T const& search) const
|
||||
{
|
||||
I i = Find(search);
|
||||
return i != InvalidIndex();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// finds a node in the tree
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user