static void InsertSortWaterLeaf( CUtlVector<waterleaf_t> &list, const waterleaf_t &leafInsert ) { // insertion sort the leaf (lowest leaves go first) // leaves that aren't actually on the surface of the water will have leaf.hasSurface == false. for ( int i = 0; i < list.Count(); i++ ) { if ( IsLowerLeaf( leafInsert, list[i] ) ) { list.InsertBefore( i, leafInsert ); return; } } // must the highest one, so stick it at the end. list.AddToTail( leafInsert ); }