Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

scan.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

Include dependency graph for scan.c:

Go to the source code of this file.

Functions

void scan_char args ((CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door))
void scan_list args ((ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door))
void do_scan (CHAR_DATA *ch, char *argument)
void scan_char (CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door)
void scan_list (ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door)

Variables

char *const distance [4]


Function Documentation

void scan_char args (CHAR_DATA *victim, CHAR_DATA *ch, sh_int depth, sh_int door)   ) 
 

void scan_list args (ROOM_INDEX_DATA *scan_room, CHAR_DATA *ch, sh_int depth, sh_int door)   ) 
 

void do_scan CHAR_DATA ch,
char *  argument
 

Definition at line 48 of file scan.c.

References act, dir_name, room_index_data::exit, MAX_INPUT_LENGTH, one_argument(), scan_list(), send_to_char(), str_cmp(), TO_CHAR, exit_data::to_room, TO_ROOM, and exit_data::u1.

Referenced by spell_farsight().

00049 {
00050     extern char *const dir_name[];
00051     char arg1[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
00052     ROOM_INDEX_DATA *scan_room;
00053     EXIT_DATA *pExit;
00054     sh_int door, depth;
00055 
00056     argument = one_argument (argument, arg1);
00057 
00058     if (arg1[0] == '\0')
00059     {
00060         act ("$n looks all around.", ch, NULL, NULL, TO_ROOM);
00061         send_to_char ("Looking around you see:\n\r", ch);
00062         scan_list (ch->in_room, ch, 0, -1);
00063 
00064         for (door = 0; door < 10; door++)
00065         {
00066             if ((pExit = ch->in_room->exit[door]) != NULL)
00067                 scan_list (pExit->u1.to_room, ch, 1, door);
00068         }
00069         return;
00070     }
00071     else if (!str_cmp (arg1, "n") || !str_cmp (arg1, "north"))
00072         door = 0;
00073     else if (!str_cmp (arg1, "e") || !str_cmp (arg1, "east"))
00074         door = 1;
00075     else if (!str_cmp (arg1, "s") || !str_cmp (arg1, "south"))
00076         door = 2;
00077     else if (!str_cmp (arg1, "w") || !str_cmp (arg1, "west"))
00078         door = 3;
00079     else if (!str_cmp (arg1, "u") || !str_cmp (arg1, "up"))
00080         door = 4;
00081     else if (!str_cmp (arg1, "d") || !str_cmp (arg1, "down"))
00082         door = 5;
00083  else if ( !str_cmp( arg1, "ne" ) || !str_cmp( arg1, "northeast"  ) )
00084 door = 6;
00085     else if ( !str_cmp( arg1, "nw" ) || !str_cmp( arg1, "northwest"  ) )
00086 door = 7;
00087     else if ( !str_cmp( arg1, "se" ) || !str_cmp( arg1, "southeast"  ) )
00088 door = 8;
00089     else if ( !str_cmp( arg1, "sw" ) || !str_cmp( arg1, "southwest"  ) )
00090 door = 9;
00091     
00092 else
00093     {
00094         send_to_char ("Which way do you want to scan?\n\r", ch);
00095         return;
00096     }
00097 
00098     act ("You peer intently $T.", ch, NULL, dir_name[door], TO_CHAR);
00099     act ("$n peers intently $T.", ch, NULL, dir_name[door], TO_ROOM);
00100     sprintf (buf, "Looking %s you see:\n\r", dir_name[door]);
00101 
00102     scan_room = ch->in_room;
00103 
00104     for (depth = 1; depth < 4; depth++)
00105     {
00106         if ((pExit = scan_room->exit[door]) != NULL)
00107         {
00108             scan_room = pExit->u1.to_room;
00109             scan_list (pExit->u1.to_room, ch, depth, door);
00110         }
00111     }
00112     return;
00113 }

Here is the call graph for this function:

void scan_char CHAR_DATA victim,
CHAR_DATA ch,
sh_int  depth,
sh_int  door
 

Definition at line 134 of file scan.c.

References dir_name, distance, MAX_INPUT_LENGTH, PERS, and send_to_char().

Referenced by scan_list().

00135 {
00136     extern char *const dir_name[];
00137     extern char *const distance[];
00138     char buf[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
00139 
00140     buf[0] = '\0';
00141 
00142     strcat (buf, PERS (victim, ch));
00143     strcat (buf, ", ");
00144     sprintf (buf2, distance[depth], dir_name[door]);
00145     strcat (buf, buf2);
00146     strcat (buf, "\n\r");
00147 
00148     send_to_char (buf, ch);
00149     return;
00150 }

Here is the call graph for this function:

void scan_list ROOM_INDEX_DATA scan_room,
CHAR_DATA ch,
sh_int  depth,
sh_int  door
 

Definition at line 115 of file scan.c.

References can_see(), get_trust(), IS_NPC, char_data::next_in_room, and scan_char().

Referenced by do_scan().

00117 {
00118     CHAR_DATA *rch;
00119 
00120     if (scan_room == NULL)
00121         return;
00122     for (rch = scan_room->people; rch != NULL; rch = rch->next_in_room)
00123     {
00124         if (rch == ch)
00125             continue;
00126         if (!IS_NPC (rch) && rch->invis_level > get_trust (ch))
00127             continue;
00128         if (can_see (ch, rch))
00129             scan_char (rch, ch, depth, door);
00130     }
00131     return;
00132 }

Here is the call graph for this function:


Variable Documentation

char* const distance[4]
 

Initial value:

 {
    "right here.", "nearby to the %s.", "not far %s.",
    "off in the distance %s."
}

Definition at line 39 of file scan.c.

Referenced by scan_char().


Generated on Thu Jan 13 22:15:20 2005 for Beyond the Shadows by  doxygen 1.4.0