776 {
778
779 int i;
780 int index_min = 0;
781 int index_max = list.Count() - 1;
782 int target_index = Math.Floor( index_max / 2 );
783
784 if ( index_max == -1 )
785 {
786 list.Insert( entry );
787 return 0;
788 }
789
791 {
793
794 while ( true )
795 {
796 string target_value_str = list[target_index].GetValueStr(
ESortType.HOST);
797
798 if ( entry_value_str == target_value_str || ((index_max - index_min) <= 1) )
799 {
800 for ( i = index_min; i <= index_max; i++ )
801 {
802 if ( entry_value_str <= list[i].GetValueStr(
ESortType.HOST) )
803 {
804 list.InsertAt( entry, i );
805 return i;
806 }
807 }
808
809 index_max++;
810 list.InsertAt( entry, index_max );
811 return target_index;
812 }
813 else if ( entry_value_str < target_value_str )
814 {
815 index_max = target_index;
816 target_index = Math.Floor( target_index / 2 );
817 }
818 else if ( entry_value_str > target_value_str )
819 {
820 index_min = target_index;
821 target_index += Math.Floor( (index_max - index_min) / 2 );
822 }
823 }
824 }
825 else
826 {
827 int entry_value_int = entry.
GetValueInt( sort_type );
828
829 while ( true )
830 {
831 int target_value_int = list[target_index].GetValueInt( sort_type );
832
833 if ( entry_value_int == target_value_int || ((index_max - index_min) <= 1) )
834 {
835 for ( i = index_min; i <= index_max; i++ )
836 {
837 if ( entry_value_int <= list[i].GetValueInt( sort_type ) )
838 {
839 list.InsertAt( entry, i );
840 return i;
841 }
842 }
843
844 index_max++;
845 list.InsertAt( entry, index_max );
846 return target_index;
847 }
848 else if ( entry_value_int < target_value_int )
849 {
850 index_max = target_index;
851 target_index = Math.Floor( target_index / 2 );
852 }
853 else if ( entry_value_int > target_value_int )
854 {
855 index_min = target_index;
856 target_index += Math.Floor( (index_max - index_min) / 2 );
857 }
858 }
859 }
860
861 return target_index;
862 }
ref map< ESortType, ref array< ref GetServersResultRow > > m_EntriesSorted
string GetValueStr(ESortType sort_type)
int GetValueInt(ESortType sort_type)