Re: [CODE] Removing a mobile from room (zedit)

From: George (greerga@circlemud.org)
Date: 01/07/99


On Fri, 8 Jan 1999, Julian Buckley wrote:

>struct char_data *get_mob_in_list_num(int num, struct char_data * list)
>{
>  struct char_data *i;
>
>  for (i = character_list; i; i = i->next)
>    if (GET_MOB_RNUM(i) == num)
>      return i;
>
>  return NULL;
>}

That is _exactly_ the same as handler.c:get_char_num(), minus unused 'list'
parameter.  Perhaps you meant to use it for something? :)

>/* Extract an mobile from the world */
>void extract_mob(struct char_data * mob)
>{
>  struct char_data *temp;
>//  char_from_room(mob);
>  REMOVE_FROM_LIST(mob, character_list, next);
>  if (GET_MOB_RNUM(mob) >= 0)
>    (mob_index[GET_MOB_RNUM(mob)].number)--;
>  if (SCRIPT(mob))
>    extract_script(SCRIPT(mob));
>  free_char(mob);
>}

You should use extract_char(), that's what it is there for.  Make sure your
'R' isn't removing the mob from the room itself.

>What I need to know is, does this look ok and should it (is it?) working
>as intended?  On the mud side, it's doing it's job, but I think I've
>overlooked something...anyone?  I also tried using the get_char_num
>function, but I don't know if I can change this:
>   if ((mob = get_mob_in_list_num(ZCMD.arg2, world[ZCMD.arg1].contents))
>!= NULL) {
>to this:
>  if ((mob = get_char_num(ZCMD.arg2)) != NULL) {

#define get_char_num(x) get_mob_in_list_num((x), character_list)

Then use your function (when you fix it to use the 2nd parameter).

--
George Greer
greerga@circlemud.org
http://mouse.van.ml.org/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST