mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier1: implement PopAt in CUtlStack
SourceSDK doesn't contain this feature, but it has to be implemented for reworking CInputStackSystem::PopInputContext() as this has changed; the method allows for popping the provided index to element rather than following a strict push/pop order.
This commit is contained in:
parent
f0fcb821a8
commit
18545ec422
@ -63,6 +63,7 @@ public:
|
||||
// Pops the stack
|
||||
void Pop();
|
||||
void Pop( T& oldTop );
|
||||
void PopAt( int index );
|
||||
void PopMultiple( int num );
|
||||
|
||||
// Makes sure we have enough memory allocated to store a requested # of elements
|
||||
@ -292,6 +293,17 @@ void CUtlStack<T,M>::Pop( T& oldTop )
|
||||
Pop();
|
||||
}
|
||||
|
||||
template< class T, class M >
|
||||
void CUtlStack<T,M>::PopAt( int index )
|
||||
{
|
||||
assert( m_Size > 0 );
|
||||
Destruct( &Element( index ) );
|
||||
|
||||
for ( int i = index ; i < ( m_Size - 1 ); ++i )
|
||||
Element( i ) = Element( i + 1 );
|
||||
--m_Size;
|
||||
}
|
||||
|
||||
template< class T, class M >
|
||||
void CUtlStack<T,M>::PopMultiple( int num )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user