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?