diff -i smaug14/src/mapout.c smaug18/src/mapout.c 8c8 < * Tricops and Fireblade | * --- > * Tricops, Fireblade, Edmond, Conran | * 55c55,60 < void draw_map( CD * ch, RID * rm, int flag, int mode ); --- > void draw_map( CHAR_DATA * ch, char map[50][50] ); > void CheckRoom( ROOM_INDEX_DATA * location, int PosX, int PosY, char map[50][50], int vnum[50][50], int depth, > int depthmap[50][50] ); > void CheckExitDir( ROOM_INDEX_DATA * location, int PosX, int PosY, int Exd, char map[50][50], int vnum[50][50], > int depth, int depthmap[50][50] ); > int center, MapDiameter; 167c172 < if ( IS_SET( room->room_flags, ROOM_NO_SUMMON ) ) --- > if ( xIS_SET( room->room_flags, ROOM_NO_SUMMON ) ) 171c176 < if ( IS_SET( room->room_flags, ROOM_SAFE ) ) --- > if ( xIS_SET( room->room_flags, ROOM_SAFE ) ) 175c180 < if ( IS_SET( room->room_flags, ROOM_DEATH ) ) --- > if ( xIS_SET( room->room_flags, ROOM_DEATH ) ) 179c184 < if ( IS_SET( room->room_flags, ROOM_INDOORS ) ) --- > if ( xIS_SET( room->room_flags, ROOM_INDOORS ) ) 228c233 < void draw_map( CD * ch, RID * rm, int flag, int mode ) --- > void draw_map( CHAR_DATA * ch, char map[50][50] ) 230,232c235,236 < MID *map_index; < RID *tmp_rm; < int i, x, y, nontriv; --- > int x, y; > char *sect; 234,247c238 < if ( !rm->map ) < { < sprintf( text_map, "(no rm->map)\n\r" ); < return; < } < if ( ( map_index = get_map_index( rm->map->vnum ) ) == NULL ) < { < bug( " No map_index with vnum %d\n\r", rm->map->vnum ); < sprintf( text_map, "-ERROR-\n\r" ); < return; < } < i = 0; < nontriv = 0; < for ( y = 0; y < 49; y++ ) --- > for ( y = 1; y <= MapDiameter; ++y ) 249c240 < for ( x = 0; x < 78; x++ ) --- > for ( x = 1; x <= MapDiameter; ++x ) 251c242 < if ( map_index->map_of_vnums[y][x] < 1 ) --- > switch ( map[x][y] ) 253,271c244,294 < text_map[i] = ' '; < i++; < continue; < } < /* < * tmp_rm = map_index -> map_of_ptrs[y][x]; < */ < tmp_rm = get_room_index( map_index->map_of_vnums[y][x] ); < if ( tmp_rm == NULL ) < { < text_map[i] = ' '; < i++; < continue; < } < if ( !tmp_rm->map ) < { < text_map[i] = ' '; < i++; < continue; --- > default: > sect = "&R&r?"; > break; > case SECT_INSIDE: > sect = "&z#"; > break; > case SECT_CITY: > sect = "&P-"; > break; > case SECT_FIELD: > sect = "&G."; > break; > case SECT_FOREST: > sect = "&G@"; > break; > case SECT_HILLS: > sect = "&G^^"; > break; > case SECT_MOUNTAIN: > sect = "&W^^"; > break; > case SECT_WATER_SWIM: > sect = "&B~"; > break; > case SECT_WATER_NOSWIM: > sect = "&B~"; > break; > case SECT_UNDERWATER: > sect = "&R&b-"; > break; > case SECT_AIR: > sect = "&W@"; > break; > case SECT_DESERT: > sect = "&Y."; > break; > case SECT_OCEANFLOOR: > sect = "&B-"; > break; > case SECT_UNDERGROUND: > sect = "&z."; > break; > case SECT_LAVA: > sect = "&R~"; > break; > case SECT_SWAMP: > sect = "&G~"; > break; > case ( SECT_MAX + 1 ): > sect = " "; > break; 274,305c297,298 < /* < * Following's kinda convoluted... If ch has ansi, < * bold the code of the room he's in. If not, indicate < * room he's in by '*' < */ < if ( ( flag == 1 ) ) < { < if ( map_index->map_of_vnums[y][x] == ch->in_room->vnum ) < { < if ( xIS_SET( ch->act, PLR_ANSI ) ) < { < text_map[i] = ( char ) '\x1B'; /* Bold */ < i++; < text_map[i] = ( char ) '['; < i++; < text_map[i] = ( char ) '1'; < i++; < text_map[i] = ( char ) 'm'; < i++; < /* < * text_map[i] = (char) tmp_rm -> map -> entry; < */ < text_map[i] = ( char ) get_map_code( tmp_rm, mode ); < i++; < text_map[i] = ( char ) '\x1B'; /* Normal */ < i++; < text_map[i] = ( char ) '['; < i++; < text_map[i] = ( char ) '0'; < i++; < text_map[i] = ( char ) 'm'; < i++; --- > if ( x == center && y == center ) > sect = "&W*"; 307,338c300,304 < } < else < { < text_map[i] = ( char ) '*'; < i++; < } < } < else < { < text_map[i] = ( char ) get_map_code( tmp_rm, mode ); < /* < * text_map[i] = (char) tmp_rm -> map -> entry; < */ < i++; < } < } < else < { < text_map[i] = ( char ) get_map_code( tmp_rm, mode ); < /* < * text_map[i] = (char) tmp_rm -> map -> entry; < */ < i++; < } < nontriv = i; < } < text_map[i] = '\n'; < i++; < } < text_map[nontriv + 2] = '\n'; < text_map[nontriv + 3] = '\r'; < text_map[nontriv + 4] = '\0'; --- > send_to_char_color( sect, ch ); > } > send_to_char( "\n\r", ch ); > } > return; 340a307 > 442c409 < void do_lookmap( CD * ch, char *argument ) --- > void do_lookmap( CHAR_DATA * ch, char *argument ) 444,446c411,415 < char arg1[MAX_STRING_LENGTH]; < char buf[MAX_STRING_LENGTH]; < int mode; --- > ROOM_INDEX_DATA *location; > int x, y; > char map[50][50]; > int vnum[50][50]; > int depthmap[50][50]; 447a417,436 > if ( !str_cmp( argument, "auto" ) ) > MapDiameter = 5; > else > MapDiameter = atoi( argument ); > > if ( MapDiameter < 3 ) > MapDiameter = 3; > else if ( MapDiameter > 49 ) > MapDiameter = 49; > > x = ( MapDiameter / 2 ) * 2; > > if ( MapDiameter == x ) > MapDiameter--; > > center = MapDiameter / 2 + 1; > // location = get_room_index(ch->in_room->vnum); > location = ch->in_room; > if ( !location ) > return; 449c438 < if ( ch->in_room->map ) --- > for ( y = 0; y <= MapDiameter; ++y ) 451c440 < if ( !argument ) --- > for ( x = 0; x <= MapDiameter; ++x ) 453c442,444 < mode = 0; --- > map[x][y] = ( SECT_MAX + 1 ); > vnum[x][y] = 0; > depthmap[x][y] = INT_MAX; 455c446,458 < else --- > } > > CheckRoom( location, center, center, map, vnum, 0, depthmap ); > > map[center][center] = location->sector_type; > vnum[center][center] = location->vnum; > > draw_map( ch, map ); > > /* > for (y = 1; y <= MapDiameter; ++y) > { > for (x = 1; x <= MapDiameter; ++x) 457,458c460 < argument = one_argument( argument, arg1 ); < mode = get_mode( arg1 ); --- > ch_printf(ch, "%5d ", vnum[x][y]); 460,468c462 < < set_char_color( AT_PLAIN, ch ); < sprintf( buf, ".------[Map %5.5d]-----------------------------------------------------------.\n\r", < ch->in_room->map->vnum ); < send_to_char( buf, ch ); < draw_map( ch, ch->in_room, 1, mode ); < send_to_char( text_map, ch ); < sprintf( buf, "`----------------------------------------------------------------------------'\n\r" ); < send_to_char( buf, ch ); --- > send_to_char("\n\r", ch); 470c464,522 < else --- > */ > return; > } > > #if 0 > void CheckRoom( ROOM_INDEX_DATA * location, int CX, int CY, char map[50][50], int vnum[50][50], int depth, > int depthmap[50][50] ) > { > int PosX, PosY; > > PosX = CX; > PosY = CY - 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_NORTH, map, vnum, depth, depthmap ); > > PosX = CX; > PosY = CY + 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_SOUTH, map, vnum, depth, depthmap ); > > PosX = CX + 1; > PosY = CY; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_EAST, map, vnum, depth, depthmap ); > > PosX = CX - 1; > PosY = CY; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_WEST, map, vnum, depth, depthmap ); > > PosX = CX + 1; > PosY = CY - 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_NORTHEAST, map, vnum, depth, depthmap ); > > PosX = CX - 1; > PosY = CY - 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_NORTHWEST, map, vnum, depth, depthmap ); > > PosX = CX + 1; > PosY = CY + 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_SOUTHEAST, map, vnum, depth, depthmap ); > > PosX = CX - 1; > PosY = CY + 1; > if ( PosX <= MapDiameter && PosY <= MapDiameter && PosX > 0 && PosY > 0 ) > CheckExitDir( location, PosX, PosY, DIR_SOUTHWEST, map, vnum, depth, depthmap ); > > return; > } > > void CheckExitDir( ROOM_INDEX_DATA * location, int X, int Y, int ExD, char map[50][50], int vnum[50][50], int depth, > int depthmap[50][50] ) > { > EXIT_DATA *xit; > > if ( ( xit = get_exit( location, ExD ) ) != NULL ) 472c524,540 < send_to_char( "You see no map here.\n\r", ch ); --- > // if(map[X][Y]==(SECT_MAX+1) && !IS_SET(xit->exit_info, EX_CLOSED)) > if ( !IS_SET( xit->exit_info, EX_CLOSED ) ) > { > // location = get_room_index(xit->vnum); > location = xit->to_room; > // if (location && depth <= depthmap[X][Y]) > if ( location && map[X][Y] > location->sector_type ) > { > // if (depth < depthmap[X][Y] || (depth == depthmap[X][Y] && vnum[X][Y] < location->sector_type)) > { > map[X][Y] = location->sector_type; > vnum[X][Y] = location->vnum; > depthmap[X][Y] = depth; > } > CheckRoom( location, X, Y, map, vnum, depth + 1, depthmap ); > } > } 473a542 > 475a545,622 > #elif 0 > void CheckRoom( ROOM_INDEX_DATA * location, int CX, int CY, char map[50][50], int vnum[50][50], int depth, > int depthmap[50][50] ) > { > static const int nexts[8][3] = { > {DIR_NORTH, 0, -1}, > {DIR_EAST, 1, 0}, > {DIR_SOUTH, 0, 1}, > {DIR_WEST, -1, 0}, > {DIR_NORTHEAST, 1, -1}, > {DIR_NORTHWEST, -1, -1}, > {DIR_SOUTHEAST, 1, 1}, > {DIR_SOUTHWEST, -1, 1}, > }; > int i; > EXIT_DATA *xit; > > if ( !location || xIS_SET( location->room_flags, ROOM_TRACK ) ) > return; > if ( CX <= MapDiameter && CY <= MapDiameter && CX > 0 && CY > 0 ) > { > if ( map[CX][CY] > location->sector_type ) > { > map[CX][CY] = location->sector_type; > vnum[CX][CY] = location->vnum; > depthmap[CX][CY] = depth; > } > } > xSET_BIT( location->room_flags, ROOM_TRACK ); > for ( i = 0; i < 8; ++i ) > { > xit = get_exit( location, nexts[i][0] ); > if ( xit && xit->to_room && xit->to_room->area == location->area && !IS_SET( xit->exit_info, EX_CLOSED ) ) > CheckRoom( xit->to_room, CX + nexts[i][1], CY + nexts[i][2], map, vnum, depth + 1, depthmap ); > } > xREMOVE_BIT( location->room_flags, ROOM_TRACK ); > } > #else > void CheckExit( ROOM_INDEX_DATA * location, int CX, int CY, const int nexts[3], char map[50][50], int vnum[50][50], > int depth, int depthmap[50][50] ) > { > EXIT_DATA *xit; > > if ( CX <= MapDiameter && CY <= MapDiameter && CX > 0 && CY > 0 ) > { > if ( map[CX][CY] > location->sector_type ) > { > map[CX][CY] = location->sector_type; > vnum[CX][CY] = location->vnum; > depthmap[CX][CY] = depth; > } > xit = get_exit( location, nexts[0] ); > if ( xit && xit->to_room && !IS_SET( xit->exit_info, EX_CLOSED ) ) > CheckExit( xit->to_room, CX + nexts[1], CY + nexts[2], nexts, map, vnum, depth + 1, depthmap ); > } > } > > void CheckRoom( ROOM_INDEX_DATA * location, int CX, int CY, char map[50][50], int vnum[50][50], int depth, > int depthmap[50][50] ) > { > static const int nexts[8][3] = { > {DIR_NORTH, 0, -1}, > {DIR_EAST, 1, 0}, > {DIR_SOUTH, 0, 1}, > {DIR_WEST, -1, 0}, > {DIR_NORTHEAST, 1, -1}, > {DIR_NORTHWEST, -1, -1}, > {DIR_SOUTHEAST, 1, 1}, > {DIR_SOUTHWEST, -1, 1}, > }; > int i; > > if ( !location ) > return; > for ( i = 0; i < 8; ++i ) > CheckExit( location, CX, CY, nexts[i], map, vnum, depth, depthmap ); > } > #endif 603a751,802 > if ( ch->prev_cmd == do_northeast ) > { > send_to_char( "Your last command started was northeast\n\r", ch ); > argument = one_argument( argument, arg1 ); > > if ( ( arg1[0] == '\0' ) ) > { > code = '#'; > } > else > { > code = arg1[0]; > } > tmp = NULL; > tmp_x = get_exit( ch->in_room, DIR_SOUTHWEST ); > if ( tmp_x ) > tmp_r = tmp_x->to_room; > if ( tmp_r ) > tmp = tmp_r->map; > > if ( !tmp ) > { > send_to_char( "No exit to southwest, or no map in southwest room. Aborting. \n\r", ch ); > return; > } > > row = ( tmp->y ); > col = ( tmp->x ) + 1; > > if ( col < 0 ) > { > send_to_char( "Can't map off the left of the buffer.\n\r", ch ); > return; > } > if ( row > 78 ) > { > send_to_char( "Can't map off the right of the buffer.\n\r", ch ); > return; > } > > mapnum = tmp->vnum; > if ( ( map_index = get_map_index( mapnum ) ) == NULL ) > { > sprintf( buf, "Trouble accessing map.(No such map?).\n\r" ); > send_to_char( buf, ch ); > return; > } > sprintf( buf, "addroom %d %d %d %c", mapnum, row, col, code ); > do_mapout( ch, buf ); > return; > } > 1003d1201 < return; 1060c1258 < location->room_flags = ROOM_PROTOTYPE && rm->room_flags; --- > xSET_BIT( location->room_flags, ROOM_PROTOTYPE );