Re: extract_char stuff.

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 03/18/01


Mysidia wrote:
>
>    Oh.. you're actually extracting every beat, so the character
> will only remain for a fraction of a second, and doing everything
> else the same I can't imagine that breaking anything; the only thing
> evil about it is the scroll through the entire player list, needing
> to extract a character is IMO a thing common enough to warrant creation
> of its own list, even if it means adding another variable to the
> char_data structure -- deaths are fairly common, particularly of mobs,
> and if all the players are out there killin' mobs successfully, unless
> they happen to all die at once there'll be a buncha traverses of the
> entire character list to extract 'em... ... the cost of that, depends
> on how many characters there are in the game, but it would seem to
> warrant the tradeoff of adding a variable.

This is actually a good idea, it'll allow you to get rid of the PLR_ and
MOB_ flags that you're proposing, plus the extractions_pending global.
Something like this added to struct char_data:

struct char_data *extract_next;

Then you have a global:

struct char_data *extract_list = NULL;

Then the new extract_char() would look like this...

void extract_char(struct char_data *ch)
{
  /* This check will not work for the last char on the list, but it's
better than nothing */
  if (ch->extract_next) {
    log("SYSERR: extract_char() called for already extracted
character.");
    return;
  }

  ch->extract_next = extract_list;
  extract_list = ch;
}

Then the new extract_pending_chars():

void extract_pending_chars(void)
{
  struct char_data *vict;

  while (extract_list) {
    vict = extract_list;
    extract_list = extract_list->extract_next;
    extract_char_final(vict);
  }
}

Regards, Peter

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST