Re: New zone command (possible code question?)

From: ShadowLord (dkoepke@california.com)
Date: 06/01/96


On Sat, 1 Jun 1996, David Blocher wrote:

> int  check_room_obj(int room, int obj){  
> struct obj_data *i;
>   int j = 0;
>   for (i = world[real_room(room)].contents; i && (j <= number); i
> =i->next_content)
>     if (obj == GET_OBJ_VNUM(i))          
>       return 1;
>   return 0;
> }

	<blink>  What?  And 'j' is?  What is 'number'?

int check_room_obj (room_num room, int obj)
{
  struct obj_data *i;

  for (i = world[room].contents; i; i = i->next_content)
    if (obj == GET_OBJ_VNUM(i))
      return 1;
  
  return 0;
}

	Room should be a real number, and obj should be a virtual number.
You should probably do the same thing for check_room_mob, and in the ACMD
do:

  room_num rnum;

  if ((rnum = real_room(virtual)) < 0) {
    send_to_char("That room doesn't exist", ch);
    return;
  }

	Where 'virtual' would be the virtual number of the room they're
checking.

	... On another note, does this command have a lot of usage?  I
mean, wouldn't, "at <room #> look" be enough to figure out if something's
in a room?  All well, doesn't matter.  I suppose it'd have some usage for
mob programs.



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