RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Character list sort

pinco

Sorceror
Character list sort

when someone delete a character in the list remain a "hole", with this modification we solve the problem. Let's start the editing from Packet.cs in the core files.

after line 2922, exactly after this:


Code:
 for ( int i = 0; i < a.Length; ++i ) 
{ 
if ( a != null ) 
highSlot = i; 
}


and after line 2891, exactly after this:



Code:
 m_Stream.Write( (byte) a.Count );

add this code block:



Code:
 // Sort for update list by Keldron Isenhart 
for ( int i = 0; i < a.Length; ++i ) 
{ 
for ( int j = i; j < a.Length; ++j ) 
{ 
if (a==null) 
{ 
[i]a=a[j]; [/i]
[i]a[j]=null; [/i]
[i]} [/i]
[i]} [/i]
[i]} [/i]
[i]//end sort [/i]
at last, compile the core and try, the problem is solved ;)
 

psz

Administrator
Hehehe. OSI still has the "hole" problem as well.


You should send this fix in to them ^_^


(j/k, of course)
 

noobie

Wanderer
are you sure that code is correct :)

i think this is what you meant:

Code:
for ( int i = 0; i < a.Length; ++i ) 
{ 
  if (a[i] == null)
  {
     for ( int j = i+1; j < a.Length; ++j ) 
    { 
       if (a[j] != null)
       {
          for(int k=i; j<a.Length; k++,j++)
         {
           a[k]=a[j]; 
           a[j]=null; 
          }
          break;
       }
    } 
  } 
}
 
Top