#include "path.h" inherit "room/room"; /* this file allows for virtual exits, f,fr,fl * (forward, forward right, forward left) * this requires an object on the player showing which direction * he/she is facing.. (in the case of hell, hobj) * by query_dir() (returns "north", etc...) * that object can deal with the player turning and facing other directions. */ init() { int i; add_action("smell", "smell"); add_action("listen","listen"); add_action("search","search"); if(!dest_dir) return; if(!HOBJ) write("You shouldn't be here.\n"); for(i=1;iquery_lost() && (i=member_array(HOBJ->query_dir(),dest_dir))!=-1) return "\nAhead you see "+dest_dir[i-1]->short(); else return ""; } long_exit_str() { /* called in /room/room.c by long() */ int i; string str; str=""; if(HOBJ && HOBJ->query_lost()) { for(i=1;iquery_dir_num(); if(i>DIR_SZ-1) i-=DIR_SZ; if(i<0) i+=DIR_SZ; return NEWDIR[i]; } can_leave(to) { /* can go over this in the room that inherits this.. */ /* return 0 to not leave */ return 1; } move(str) { int i; string arg; if(str) return 0; if(query_verb()=="forward") { if(!HOBJ || !HOBJ->query_lost()) return 0; i=member_array(HOBJ->query_dir(),dest_dir); if(i==-1) return write("You bump into the wall.\n"); arg="forward#"+dest_dir[i-1]; } else { if(HOBJ && HOBJ->query_lost()) return 0; i=member_array(query_verb(),dest_dir); if(i==-1) return 0; arg=dest_dir[i]+"#"+dest_dir[i-1]; } if(!can_leave(dest_dir[i-1])) return 1; TP->move_player(arg); if(HOBJ) HOBJ->moved(); return 1; }