Re: Character "Vehicles"

From: Benjamin Draper (satrycus@drachenburg.demon.co.uk)
Date: 01/25/99


Nick Stout wrote:
>
>  void mount_char(struct char_data *ch, struct char_data *mount) {
>    DRIVING(ch) = mount;
>    DRIVEN_BY(mount) = ch;
>    GET_OWNED_MOB(ch) = mount;
> }
>
> So how do i get the vnum of the mount?

tried this?

GET_OWNED_MOB(ch) = GET_MOB_VNUM(DRIVING(ch));

...or maybe my brain has melted.

I still think you should think about using objects as the vehicles,
primarily because you can use the same code for things like furniture,
or simply objects that can be entered, like tents. I'm thinking of the
functions that would reside in handler.c here.

I use something like the following for this sort of stuff:

<MAILER CODE>

void char_to_object(struct char_data *ch, struct obj_data *obj)
{
  if (!ch || !obj)
    log("error message");
  else {
    ch->next_in_obj = obj->people;
    obj->people = ch;

    switch (GET_OBJ_TYPE(obj)) {
    case ITEM_FURNITURE:
      FURNITURE(ch) = obj;
      break;
    case ITEM_VEHICLE:
      VEHICLE(ch) = obj;
      break;
    default:
      IN_OBJECT(ch) = obj;
      break;
    }
  }
}


There's bound to be a better way but it works sweetly for me.

-> Ben


     +------------------------------------------------------------+
     | 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