/* Display the map to the player */ void show_map( CHAR_DATA * ch, char *text ) { char buf[MAX_STRING_LENGTH * 2]; int x, y, pos; char *p; bool alldesc = FALSE; /* Has desc been fully displayed? */ if ( !text ) alldesc = TRUE; pos = 0; p = text; buf[0] = '\0'; /* * Show exits */ if ( xIS_SET( ch->act, PLR_AUTOEXIT ) ) snprintf( buf, MAX_STRING_LENGTH * 2, "%s%s", color_str( AT_EXITS, ch ), get_exits( ch ) ); else mudstrlcpy( buf, "", MAX_STRING_LENGTH * 2 ); /* * Top of map frame */ mudstrlcat( buf, "&z+-----------+&w ", MAX_STRING_LENGTH * 2 ); if ( !alldesc ) { pos = get_line( p, 63 ); if ( pos > 0 ) { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; } else { mudstrlcat( buf, color_str( AT_RMDESC, ch ), MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); /* * Write out the main map area with text */ for ( y = 0; y <= MAPY; ++y ) { mudstrlcat( buf, "&z|&D", MAX_STRING_LENGTH * 2 ); for ( x = 0; x <= MAPX; ++x ) { switch ( dmap[x][y].tegn ) { case '-': case '|': case '\\': case '/': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&O%c&d", dmap[x][y].tegn ); break; case '@': // Character is standing here snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case 'O': // Indoors snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&w%c&d", dmap[x][y].tegn ); break; case '=': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&B%c&d", dmap[x][y].tegn ); break; case '~': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&C%c&d", dmap[x][y].tegn ); break; case '+': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; case '*': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&g%c&d", dmap[x][y].tegn ); break; case 'X': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&R%c&d", dmap[x][y].tegn ); break; case ':': snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "&Y%c&d", dmap[x][y].tegn ); break; default: // Empty space snprintf( buf + strlen( buf ), ( MAX_STRING_LENGTH * 2 ) - strlen( buf ), "%c", dmap[x][y].tegn ); break; } } mudstrlcat( buf, "&z|&D ", MAX_STRING_LENGTH * 2 ); /* * Add the text, if necessary */ if ( !alldesc ) { pos = get_line( p, 63 ); char col[10], c[2]; strcpy( c, whatColor( text, p ) ); if ( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if ( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } /* * Finish off map area */ mudstrlcat( buf, "&z+-----------+&D ", MAX_STRING_LENGTH * 2 ); if ( !alldesc ) { char col[10], c[2]; pos = get_line( p, 63 ); strcpy( c, whatColor( text, p ) ); if ( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if ( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } /* * Deal with any leftover text */ if ( !alldesc ) { char col[10], c[2]; do { /* * Note the number - no map to detract from width */ pos = get_line( p, 78 ); strcpy( c, whatColor( text, p ) ); if ( c[0] == '\0' ) mudstrlcpy( col, color_str( AT_RMDESC, ch ), 10 ); else snprintf( col, 10, "%s", c ); if ( pos > 0 ) { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); strncat( buf, p, pos ); p += pos; mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH * 2 ); } else { mudstrlcat( buf, col, MAX_STRING_LENGTH * 2 ); mudstrlcat( buf, p, MAX_STRING_LENGTH * 2 ); alldesc = TRUE; } } while ( !alldesc ); } mudstrlcat( buf, "&D\r\n", MAX_STRING_LENGTH * 2 ); send_to_char( buf, ch ); }
/* Display the map to the player */ void show_map( CHAR_DATA *ch, char *text ) { char buf[MAX_STRING_LENGTH * 2]; int x, y, pos; char *p; bool alldesc = FALSE; /* Has desc been fully displayed? */ if ( !text ) alldesc = TRUE; pos = 0; p = text; buf[0] = '\0'; /* Top of map frame */ if (ch->level > 6) xprintf( buf, "#0/----#BMAP#0----\\#n %s #0[#w%d#0]#n\n\r", //xprintf( buf, "#0+-----------+#n %s #0[#w%d#0]#n\n\r", ch->in_room->name, ch->in_room->vnum); else xprintf( buf, "#0/----#BMAP#0----\\#n %s\n\r", ch->in_room->name); /* Write out the main map area with text */ for( y = 0; y <= MAPY; y++ ) { xcatf( buf, "#0<#n" ); for( x = 0; x <= MAPX; x++ ) { switch(map[x][y].tegn) { case '-': case '|': xcatf(buf, "#y%c#n", map[x][y].tegn); break; case 'X': xcatf(buf, "#R%c#n", map[x][y].tegn); break; case '*': xcatf(buf, "#g%c#n", map[x][y].tegn); break; case '@': xcatf(buf, "#y%c#n", map[x][y].tegn); break; case '=': xcatf(buf, "#B%c#n", map[x][y].tegn); break; case '~': xcatf(buf, "#C%c#n", map[x][y].tegn); break; case '+': xcatf(buf, "#Y%c#n", map[x][y].tegn); break; default: xcatf(buf, "%c", map[x][y].tegn ); } } xcatf( buf, "#0>#n " ); if (y == 0 && IS_SET(ch->act2, PLR_AUTOEXIT)) // the autoexits { xcatf(buf, "%s", get_exits(ch)); continue; } /* Add the text, if necessary */ if ( !alldesc ) { pos = get_line( p, 63 ); if ( pos > 0 ) { strncat( buf, p, pos ); p += pos; } else { strcat( buf, p ); alldesc = TRUE; } } strcat( buf, "\n\r" ); } /* Finish off map area */ xcatf( buf, "#0\\___________/#n " ); //strcat( buf, "#0+-----------+#n " ); if ( !alldesc ) { pos = get_line( p, 63 ); if ( pos > 0 ) { strncat( buf, p, pos ); xcatf(buf, "\n\r"); p += pos; } else { xcatf( buf, p ); alldesc = TRUE; } } /* Deal with any leftover text */ if ( !alldesc ) { do { /* Note the number - no map to detract from width */ pos = get_line( p, 78 ); if ( pos > 0 ) { strncat( buf, p, pos ); xcatf(buf, "\n\r"); p += pos; } else { xcatf( buf, p ); alldesc = TRUE; } } while( !alldesc ); } xcatf(buf, "\n\r"); send_to_char(buf, ch); }