759 {
761
762 int i;
763 int index_min = 0;
764 int index_max = list.Count() - 1;
765 int target_index = Math.Floor( index_max / 2 );
766
767 if ( index_max == -1 )
768 {
769 list.Insert( entry );
770 return 0;
771 }
772
774 {
776
777 while ( true )
778 {
779 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
780
781 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
782 {
783 for ( i = index_min; i <= index_max; i++ )
784 {
785 if ( entry_value_str <= list[i].GetValueStr(
ESortType.HOST) )
786 {
787 list.InsertAt( entry, i );
788 return i;
789 }
790 }
791
792 index_max++;
793 list.InsertAt( entry, index_max );
794 return target_index;
795 }
796 else if ( entry_value_str < target_value_str )
797 {
798 index_max = target_index;
799 target_index = Math.Floor( target_index / 2 );
800 }
801 else if ( entry_value_str > target_value_str )
802 {
803 index_min = target_index;
804 target_index += Math.Floor( (index_max - index_min) / 2 );
805 }
806 }
807 }
808 else
809 {
810 int entry_value_int = entry.
GetValueInt( sort_type );
811
812 while ( true )
813 {
814 int target_value_int = list[target_index].GetValueInt( sort_type );
815
816 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
817 {
818 for ( i = index_min; i <= index_max; i++ )
819 {
820 if ( entry_value_int <= list[i].GetValueInt( sort_type ) )
821 {
822 list.InsertAt( entry, i );
823 return i;
824 }
825 }
826
827 index_max++;
828 list.InsertAt( entry, index_max );
829 return target_index;
830 }
831 else if ( entry_value_int < target_value_int )
832 {
833 index_max = target_index;
834 target_index = Math.Floor( target_index / 2 );
835 }
836 else if ( entry_value_int > target_value_int )
837 {
838 index_min = target_index;
839 target_index += Math.Floor( (index_max - index_min) / 2 );
840 }
841 }
842 }
843
844 return target_index;
845 }
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
string GetValueStr(ESortType sort_type)
int GetValueInt(ESortType sort_type)