http://www.the-infinite.org/lists/romlist/2000/01/msg00221.html

Opinion:
Would the above be an acceptable place to start on sorting characters for who?

I think it looks very promising.


----- Original Message ----- 
From: "Cameron Matthews-Dickson" <[EMAIL PROTECTED]>
To: "Jeremy Hill" <[EMAIL PROTECTED]>
Sent: Saturday, July 13, 2002 7:12 PM
Subject: Re: hack way of sorting who list by level


> Well,
>     A sorted linked-list would be faster as far as outputting the who list
> since all you'd have to do is iterate through it.  Doing the qsort would
> mean putting the descriptor_list into an array and then calling qsort on it
> which would be a little slower.  Having a sorted linked list is a little
> slower for insertions....both options would be better than your current
> solution, I would think....
> 
> Cam
> 
> 
> ----- Original Message -----
> From: "Jeremy Hill" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Saturday, July 13, 2002 7:25 PM
> Subject: hack way of sorting who list by level
> 
> 
> > Based on:
> >
> > int i;
> > for (i = 1; i <= MAX_LEVEL; i++)
> > {
> >     for ( d = descriptor_list; d != NULL; d = d->next )
> >     {
> >         CHAR_DATA *wch;
> >         ...
> >         (wch to descriptor)
> >         ...
> >         if (wch->level == i)
> >             print_to_who(wch);
> >    }
> > }
> >
> > I figure this will work, but on a MUD with 310 levels and just 10 people
> on, it
> > would generate 3,100 loops.
> >
> > A couple of questions:
> > 1. In your expert opinion, is this a miserable way to do it?  Pros?  Cons?
> I
> > figure sorting or qsorting the linked list of characters would be better.
> >
> > 2. Would it be easier to add players to the list of players on connect so
> they
> > are automatically sorted by level?
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >


Reply via email to