In attempt to sort the who list, I made this simple funtion that will sort the descriptor_list by level. Anytime the characters level is changed, the list is updated appropriately. The function: void sort_desc_in_list(struct descriptor_data *d) { struct descriptor_data *temp, *prev; //* If this is the only desc return if ((descriptor_list->character == d->character) && !d->next) return; //* remove the desc from list REMOVE_FROM_LIST(d, descriptor_list, next); //* find the correct spot fo the desc for (temp = descriptor_list,prev=NULL; temp;) { if (temp->character && (GET_LEVEL(temp->character) < GET_LEVEL(d->character))) { //* We've found the spot...put in here d->next = temp; if (!prev) descriptor_list = d; else prev->next = d; break; } else { //* If this is the end, stick desc here. if ((temp->character != d->character) && !temp->next) { d->next = NULL; temp->next = d; break; } //* Step to next in list prev = temp; temp = temp->next; } } } The function simply removes the descriptor from the list, and reinserts it in the right spot. It sorts only by level, and not by character name. To use it, I called it from nanny right after it loads the player.. store_to_char(&tmp_store, d->character); GET_PFILEPOS(d->character) = player_i; +sort_desc_in_list(d); and add it in the do_gain_level(I think thats the one), do_set, or anywhere wlse the players level is changed. One more thing..... I have changed the way that the obj/mob limits work. I added a max_exist variable to index_data so that no more than max_exist can exist anywhere on the mud at one time. I also changed zreset to first check for index_data.max_exist first, then check the args of the xone command for max_in_room, max_in_container, and max_in_mob, etc. This provides much better control on the num_exist and resets of mobs/objs. if anyone is interested, I can pull out all the code changes, and send it to the list, or ftp site. Just e-mail me if interested. *>Jon<* +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST