

/* This routine only gets used by 'do_unlock' */
int  match_key(struct char_data *ch, int key)
{
	struct object_data *obj, *obj_next;

	/* He who is greater can always unlock */
	if(ch->LEVEL >= GOD)
		return(1);

	/* As he who isn't can always hope */
	for(obj=ch->carrying;obj;obj=obj_next) {
		obj_next = obj->next_carried;
		if(obj->IDNUM == key)
			return(key);
	}
   if(((ch->wearing[0]) && ch->wearing[0]->IDNUM == key) ||
      ((ch->wearing[1]) && ch->wearing[1]->IDNUM == key)) {
		return(key);
	} else {
		return(0);
	}
}

int	exit_cmp(char *name, struct room_data *room)
{
	int	c=0;
	for(c=0;c<10;c++) {
		if(room->exits[c]) {
         if((!str_cmp(name,exit_list[c].name) || !str_cmp(name,exit_list[c].brief)) ||
           ((room->exits[c]->alias) && !str_cmp(name,room->exits[c]->alias))) {
				return(c);
			}
		}
	}
	return(-1);
}

