#include "include.h" char *const distance[4] = { "right here.", "nearby to the %s.", "not far %s.", "off in the distance %s." }; void scan_list args((ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door)); void scan_char args((CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door)); int scan_room(CHAR_DATA *ch, const ROOM_INDEX_DATA *room, char *buf) { CHAR_DATA *target = room->people; int number_found = 0; while(target != NULL) { if(can_see(ch,target)) { strcat(buf, " - "); strcat(buf, IS_NPC(target) ? target->short_descr : target->name); strcat(buf, "\n\r"); number_found++; } target = target->next_in_room; } return number_found; } void do_scan(CHAR_DATA *ch, char *argument) { EXIT_DATA *pexit; ROOM_INDEX_DATA *room; extern char *const dir_name[]; char buf[MSL]; int dir; int distance; if(ch->fighting != NULL) return; sprintf(buf,"Right here you see:\n\r"); if(scan_room(ch,ch->in_room,buf) == 0) strcat(buf,"Noone\n\r"); send_to_char(buf,ch); for(dir = 0; dir < 6; dir++) { room = ch->in_room; for(distance = 1; distance < 4; distance++) { pexit = room->exit[dir]; if((pexit == NULL) || (pexit->u1.to_room == NULL) || (IS_SET(pexit->exit_info, EX_CLOSED))) break; sprintf(buf,"%d %s from here you see:\n\r",distance,dir_name[dir]); if(scan_room(ch,pexit->u1.to_room,buf)) send_to_char(buf,ch); room = pexit->u1.to_room; } } } void scan_list(ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door) { CHAR_DATA *rch; if(scan_room == NULL) return; for(rch = scan_room->people; rch != NULL; rch = rch->next_in_room) { if(rch == ch) continue; if(!IS_NPC(rch) && rch->invis_level > get_trust(ch)) continue; if(can_see(ch,rch)) scan_char(rch,ch,depth,door); } return; } void scan_char(CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door) { extern char *const dir_name[]; extern char *const distance[]; char buf[MIL], buf2[MIL]; buf[0] = '\0'; strcat(buf, PERS(victim,ch)); strcat(buf, ", "); sprintf(buf2, distance[depth], dir_name[door]); strcat(buf, buf2); strcat(buf, "\n\r"); send_to_char(buf,ch); return; }