Re: [code]OBJ_VAL() within a range for rooms

From: Daniel Koepke (dkoepke@california.com)
Date: 01/15/97


On Wed, 15 Jan 1997, pjh wrote:

> I am coding in a ladder object that essentially is a 'warp' object.  When
> you create it you have two variables:
> destination room number
> and duration
> When i code in the do_climb command i would like to devise a way of making
> it check to see if the destination room number that the object was
> assigned is legitamit.  As in it will scan the room table db thing.  That
> is where i am stumped.  How can i get it so that when it runs it will
> check that the VAL of the OBJ is between room 0 and top_of_list or
> whatever it is for rooms.

Uhm, gee:

  if (GET_OBJ_VAL(obj, 0) >= 0 && GET_OBJ_VAL(obj, 0) <= top_of_roomt) {
    .
    .
    .
  }

Of course, that doesn't verify that the room exists.  Do a real_room()
to get the real number.  If it's equal to NOWHERE (-1) then the room
doesn't exist.

  extern struct index_data *obj_index;

  if (real_room(GET_OBJ_VAL(obj, 0)) == NOWHERE) {
    sprintf(buf, "Obj vnum #%d, val 0: Non-existant destination room.\r\n",
            GET_OBJ_VNUM(obj));
    log(buf);
    return;
  }

Hm.


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