Re: [NEWBIE] Spell Target

From: Daniel Koepke (dkoepke@california.com)
Date: 12/14/96


On Sat, 14 Dec 1996, Joe Frohne wrote:

> stiff = get_char_num(GET_OBJ_COST(obj));  /*supposed to return pointer toPC*/
> char_from_room(stiff);
> char_to_room(stiff, ch->in_room);
> 
> What happens is get_char_num searches for the MOB with the rnum and not 
> PC's vnum.  Basicaly all I want to do is find a character in the world 
> based on either his/her name or vnum.  I just dont see the function I 
> should use.

You can try this...

  struct char_data *get_char_by_id(long id) {
    struct descriptor_data *d = descriptor_data;

    while (d && (!d->character || GET_IDNUM(d->character) != id))
      d = d->next;
    if (d)
      return (d->character);
    return NULL;
  }


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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