/* Clear, generate and display the map */ void draw_map( CHAR_DATA *ch, char *desc ) { int x, y; static char buf[MAX_STRING_LENGTH]; xprintf( buf, desc ); /* Remove undesirable characters */ reformat_desc( buf ); /* Clear map */ for( y = 0; y <= MAPY; y++ ) { for( x = 0; x <= MAPX; x++ ) { clear_coord( x, y ); } } /* Start with players pos at centre of map */ x = MAPX / 2; y = MAPY / 2; map[x][y].vnum = ch->in_room->vnum; map[x][y].depth = 0; /* Generate the map */ map_exits( ch, ch->in_room, x, y, 0 ); /* Current position should be a "X" */ map[x][y].tegn = 'X'; /* Send the map */ show_map( ch, buf ); }
/* Clear all exits for one room */ void clear_room( int x, int y ) { int dir, exitx, exity; /* Cycle through the four directions */ for( dir = 0; dir < 4; dir++ ) { /* Find next coord in this direction */ get_exit_dir( dir, &exitx, &exity, x, y ); /* If coord is valid, clear it */ if ( !BOUNDARY( exitx, exity ) ) clear_coord( exitx, exity ); } }
/* Clear, generate and display the map */ void draw_room_map( CHAR_DATA * ch, const char *desc ) { int x, y; static char buf[MAX_STRING_LENGTH]; mudstrlcpy( buf, desc, MAX_STRING_LENGTH ); /* * Remove undesirable characters */ reformat_desc( buf ); /* * Clear map */ for ( y = 0; y <= MAPY; ++y ) { for ( x = 0; x <= MAPX; ++x ) { clear_coord( x, y ); } } /* * Start with players pos at centre of map */ x = MAPX / 2; y = MAPY / 2; dmap[x][y].vnum = ch->in_room->vnum; dmap[x][y].depth = 0; /* * Generate the map */ map_exits( ch, ch->in_room, x, y, 0 ); /* * Current position should be a "X" */ dmap[x][y].tegn = '@'; dmap[x][y].sector = -1; /* * Send the map */ show_map( ch, buf ); }