Re: Trouble determining how to express something.

From: Geoff Davis (darwin@telocity.com)
Date: 08/29/02


> > I'm having difficulty determining how to express something.  Essentially
I
> > want to be able to check zone information before movement.  So say if a
> > zone is numbered less than 100 someone can walk in as a mortal, but over
> > 100 they can't.  Or say if the zone top number is over 10000 they can't.
> > Or whatever.
> >
>
> if (world[IN_ROOM(ch)].zone < the_zonenumber_you_wanna_use_here) {
>     do somthing;
>     return 0;
> }
[-snip-]

Actually, the zone member of the room_data structure is a zone_rnum, if
memory
serves. Furthermore, this check needs to be done when the character is
actually
moved in the given direction. What you probably intended was something along
the lines of:

/*
 * do_simple_move() assumes that an exit exists in the indicated direction,
and
 * that said direction (and exit) is indeed completely valid. If such an
assumption
 * could not be made, we would need additional checks (probably before) this
 * one. I would *personally* put this code right after the boat check.
 */
if (zone_table[world[EXIT(ch, dir)->to_room].zone].number < lower_bound ||
    zone_table[world[EXIT(ch, dir)->to_room].zone].number > upper_bound) {
    do_something();
    return (0);
}

-Geoff

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT