This update includes the transition to protocoloutput while maintaining backwards compatibility with all MUDs still using proc_colors

This commit is contained in:
Vatiken 2012-03-16 01:26:00 +00:00
parent 0fd579d3d4
commit f0a80caaa3
25 changed files with 210 additions and 233 deletions

View file

@ -32,7 +32,7 @@ ACMD(do_say)
char buf[MAX_INPUT_LENGTH + 14], *msg;
struct char_data *vict;
snprintf(buf, sizeof(buf), "$n@n says, '%s@n'", argument);
snprintf(buf, sizeof(buf), "$n\tn says, '%s\tn'", argument);
msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG);
for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room)
@ -42,7 +42,7 @@ ACMD(do_say)
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
else {
sprintf(buf, "You say, '%s@n'", argument);
sprintf(buf, "You say, '%s\tn'", argument);
msg = act(buf, FALSE, ch, 0, 0, TO_CHAR | DG_NO_TRIG);
add_history(ch, msg, HIST_SAY);
}
@ -74,7 +74,7 @@ ACMD(do_gsay)
else
k = ch;
snprintf(buf, sizeof(buf), "$n tells the group, '%s@n'", argument);
snprintf(buf, sizeof(buf), "$n tells the group, '%s\tn'", argument);
if (AFF_FLAGGED(k, AFF_GROUP) && (k != ch))
act(buf, FALSE, ch, 0, k, TO_VICT | TO_SLEEP);
@ -85,7 +85,7 @@ ACMD(do_gsay)
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
else
send_to_char(ch, "You tell the group, '%s@n'\r\n", argument);
send_to_char(ch, "You tell the group, '%s\tn'\r\n", argument);
}
}

View file

@ -1558,7 +1558,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg)
if (!*arg) {
j = world[(IN_ROOM(ch))].zone;
send_to_char(ch, "Players in %s@n.\r\n--------------------\r\n", zone_table[j].name);
send_to_char(ch, "Players in %s\tn.\r\n--------------------\r\n", zone_table[j].name);
for (d = descriptor_list; d; d = d->next) {
if (STATE(d) != CON_PLAYING || d->character == ch)
continue;
@ -2538,9 +2538,9 @@ ACMD(do_areas)
if (show_zone) {
if (overlap) overlap_shown = TRUE;
lev_set = get_zone_levels(i, lev_str);
tmp_len = snprintf(buf+len, sizeof(buf)-len, "@n(%3d) %s%-*s@n %s%s@n\r\n", ++zcount, overlap ? QRED : QCYN,
tmp_len = snprintf(buf+len, sizeof(buf)-len, "\tn(%3d) %s%-*s\tn %s%s\tn\r\n", ++zcount, overlap ? QRED : QCYN,
count_color_chars(zone_table[i].name)+30, zone_table[i].name,
lev_set ? "@c" : "@n", lev_set ? lev_str : "All Levels");
lev_set ? "\tc" : "\tn", lev_set ? lev_str : "All Levels");
len += tmp_len;
}
}

View file

@ -31,6 +31,7 @@
#include "mail.h" /* for has_mail() */
#include "shop.h"
#include "quest.h"
#include "modify.h"
/* Local defined utility functions */
/* do_group utility functions */
@ -302,6 +303,7 @@ ACMD(do_title)
{
skip_spaces(&argument);
delete_doubledollar(argument);
parse_at(argument);
if (IS_NPC(ch))
send_to_char(ch, "Your title is fine... go away.\r\n");
@ -973,7 +975,7 @@ ACMD(do_happyhour)
" @yhappyhour default @w- sets a default setting for happyhour\r\n\r\n"
"Configure the happyhour settings and start a happyhour.\r\n"
"Currently 1 hour IRL = %d ticks\r\n"
"If no number is specified, 0 (off) is assumed.\r\nThe command @yhappyhour time@n will therefore stop the happyhour timer.\r\n",
"If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n",
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),

View file

@ -2224,11 +2224,11 @@ ACMD(do_wiznet)
return;
}
if (level > LVL_IMMORT) {
snprintf(buf1, sizeof(buf1), "@c%s: <%d> %s%s@n", GET_NAME(ch), level, emote ? "<--- " : "", argument);
snprintf(buf2, sizeof(buf1), "@cSomeone: <%d> %s%s@n", level, emote ? "<--- " : "", argument);
snprintf(buf1, sizeof(buf1), "\tc%s: <%d> %s%s\tn", GET_NAME(ch), level, emote ? "<--- " : "", argument);
snprintf(buf2, sizeof(buf1), "\tcSomeone: <%d> %s%s\tn", level, emote ? "<--- " : "", argument);
} else {
snprintf(buf1, sizeof(buf1), "@c%s: %s%s@n", GET_NAME(ch), emote ? "<--- " : "", argument);
snprintf(buf2, sizeof(buf1), "@cSomeone: %s%s@n", emote ? "<--- " : "", argument);
snprintf(buf1, sizeof(buf1), "\tc%s: %s%s\tn", GET_NAME(ch), emote ? "<--- " : "", argument);
snprintf(buf2, sizeof(buf1), "\tcSomeone: %s%s\tn", emote ? "<--- " : "", argument);
}
for (d = descriptor_list; d; d = d->next) {
@ -4378,8 +4378,8 @@ ACMD(do_file)
req_file_lines = file_numlines(req_file);
snprintf( buf, sizeof(buf),
"@gFile:@n %s@g; Min. Level to read:@n %d@g; File Location:@n %s@g\r\n"
"File size (bytes):@n %ld@g; Total num lines:@n %d\r\n",
"\tgFile:\tn %s\tg; Min. Level to read:\tn %d\tg; File Location:\tn %s\tg\r\n"
"File size (bytes):\tn %ld\tg; Total num lines:\tn %d\r\n",
fields[l].cmd, fields[l].level, fields[l].file, (long) req_file_size,
req_file_lines);
@ -4387,13 +4387,13 @@ ACMD(do_file)
if ( (fields[l].read_backwards == TRUE) && (req_lines < req_file_lines) )
{
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"@gReading from the tail of the file.@n\r\n\r\n" );
"\tgReading from the tail of the file.\tn\r\n\r\n" );
lines_read = file_tail( req_file, buf, sizeof(buf), req_lines );
}
else
{
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"@gReading from the head of the file.@n\r\n\r\n" );
"\tgReading from the head of the file.\tn\r\n\r\n" );
lines_read = file_head( req_file, buf, sizeof(buf), req_lines );
}
@ -4403,19 +4403,19 @@ ACMD(do_file)
{
/* We're reading the entire file */
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"\r\n@gEntire file returned (@n%d @glines).@n\r\n",
"\r\n\tgEntire file returned (\tn%d \tglines).\tn\r\n",
lines_read );
}
else if ( lines_read == max_lines_to_read )
{
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"\r\n@gMaximum number of @n%d @glines returned.@n\r\n",
"\r\n\tgMaximum number of \tn%d \tglines returned.\tn\r\n",
lines_read );
}
else
{
snprintf( buf + strlen(buf), sizeof(buf) - strlen(buf),
"\r\n%d @glines returned.@n\r\n",
"\r\n%d \tglines returned.\tn\r\n",
lines_read );
}

View file

@ -203,6 +203,7 @@ static void aedit_save_internally(struct descriptor_data *d) {
static void aedit_save_to_disk(struct descriptor_data *d) {
FILE *fp;
int i;
char buf[MAX_STRING_LENGTH];
if (!(fp = fopen(SOCMESS_FILE_NEW, "w+"))) {
char error[MAX_STRING_LENGTH];
snprintf(error, sizeof(error), "Can't open socials file '%s'", SOCMESS_FILE);
@ -218,23 +219,31 @@ static void aedit_save_to_disk(struct descriptor_data *d) {
soc_mess_list[i].min_char_position,
soc_mess_list[i].min_victim_position,
soc_mess_list[i].min_level_char);
fprintf(fp, "%s\n%s\n%s\n%s\n",
sprintf(buf, "%s\n%s\n%s\n%s\n",
((soc_mess_list[i].char_no_arg)?soc_mess_list[i].char_no_arg:"#"),
((soc_mess_list[i].others_no_arg)?soc_mess_list[i].others_no_arg:"#"),
((soc_mess_list[i].char_found)?soc_mess_list[i].char_found:"#"),
((soc_mess_list[i].others_found)?soc_mess_list[i].others_found:"#"));
fprintf(fp, "%s\n%s\n%s\n%s\n",
fprintf(fp, convert_from_tabs(buf), 0);
sprintf(buf, "%s\n%s\n%s\n%s\n",
((soc_mess_list[i].vict_found)?soc_mess_list[i].vict_found:"#"),
((soc_mess_list[i].not_found)?soc_mess_list[i].not_found:"#"),
((soc_mess_list[i].char_auto)?soc_mess_list[i].char_auto:"#"),
((soc_mess_list[i].others_auto)?soc_mess_list[i].others_auto:"#"));
fprintf(fp, "%s\n%s\n%s\n",
fprintf(fp, convert_from_tabs(buf), 0);
sprintf(buf, "%s\n%s\n%s\n",
((soc_mess_list[i].char_body_found)?soc_mess_list[i].char_body_found:"#"),
((soc_mess_list[i].others_body_found)?soc_mess_list[i].others_body_found:"#"),
((soc_mess_list[i].vict_body_found)?soc_mess_list[i].vict_body_found:"#"));
fprintf(fp, "%s\n%s\n\n",
fprintf(fp, convert_from_tabs(buf), 0);
sprintf(buf, "%s\n%s\n\n",
((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"),
((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#"));
fprintf(fp, convert_from_tabs(buf), 0);
}
fprintf(fp, "$\n");

View file

@ -64,6 +64,8 @@
#define MAP_NORMAL 0
#define MAP_COMPACT 1
static bool show_worldmap(struct char_data *ch);
struct map_info_type
{
int sector_type;
@ -73,16 +75,16 @@ struct map_info_type
static struct map_info_type door_info[] =
{
{ DOOR_NONE, " " },
{ DOOR_DOWN_AND_SE, "@r-@n\\ " },
{ DOOR_UP_AND_NE, "@r+@n/ " },
{ VDOOR_DIAGNW, " @m+@n " },
{ VDOOR_DIAGNE, " @m+@n "},
{ VDOOR_EW, " @m+@n " },
{ VDOOR_NS, " @m+@n "},
{ DOOR_DOWN_AND_SE, "\tr-\tn\\ " },
{ DOOR_UP_AND_NE, "\tr+\tn/ " },
{ VDOOR_DIAGNW, " \tm+\tn " },
{ VDOOR_DIAGNE, " \tm+\tn "},
{ VDOOR_EW, " \tm+\tn " },
{ VDOOR_NS, " \tm+\tn "},
{ DOOR_DIAGNW, " \\ " },
{ DOOR_DIAGNE, " / " },
{ DOOR_DOWN, "@r-@n " },
{ DOOR_UP, "@r+@n " },
{ DOOR_DOWN, "\tr-\tn " },
{ DOOR_UP, "\tr+\tn " },
{ DOOR_EW, " - " },
{ DOOR_NS, " | " }
};
@ -90,16 +92,16 @@ static struct map_info_type door_info[] =
static struct map_info_type compact_door_info[] =
{
{ DOOR_NONE, " " },
{ DOOR_DOWN_AND_SE, "@R\\@n" },
{ DOOR_UP_AND_NE, "@R/@n" },
{ VDOOR_DIAGNW, "@m+@n" },
{ VDOOR_DIAGNE, "@m+@n"},
{ VDOOR_EW, " @m+@n " },
{ VDOOR_NS, " @m+@n "},
{ DOOR_DOWN_AND_SE, "\tR\\\tn" },
{ DOOR_UP_AND_NE, "\tR/\tn" },
{ VDOOR_DIAGNW, "\tm+\tn" },
{ VDOOR_DIAGNE, "\tm+\tn"},
{ VDOOR_EW, " \tm+\tn " },
{ VDOOR_NS, " \tm+\tn "},
{ DOOR_DIAGNW,"\\" },
{ DOOR_DIAGNE,"/" },
{ DOOR_DOWN, "@r-@n" },
{ DOOR_UP, "@r+@n" },
{ DOOR_DOWN, "\tr-\tn" },
{ DOOR_UP, "\tr+\tn" },
{ DOOR_EW, "-" },
{ DOOR_NS, " | " }
};
@ -109,16 +111,16 @@ static struct map_info_type compact_door_info[] =
/* New sectors also need to be added to the perform_map function below */
static struct map_info_type map_info[] =
{
{ SECT_INSIDE, "@c[@n.@c]@n" }, /* 0 */
{ SECT_CITY, "@c[@wC@c]@n" },
{ SECT_FIELD, "@c[@g,@c]@n" },
{ SECT_FOREST, "@c[@gY@c]@n" },
{ SECT_HILLS, "@c[@Mm@c]@n" },
{ SECT_MOUNTAIN, "@c[@rM@c]@n" }, /* 5 */
{ SECT_WATER_SWIM, "@c[@c~@c]@n" },
{ SECT_WATER_NOSWIM, "@c[@b=@c]@n" },
{ SECT_FLYING, "@c[@C^@c]@n" },
{ SECT_UNDERWATER, "@c[@bU@c]@n" },
{ SECT_INSIDE, "\tc[\tn.\tc]\tn" }, /* 0 */
{ SECT_CITY, "\tc[\twC\tc]\tn" },
{ SECT_FIELD, "\tc[\tg,\tc]\tn" },
{ SECT_FOREST, "\tc[\tgY\tc]\tn" },
{ SECT_HILLS, "\tc[\tMm\tc]\tn" },
{ SECT_MOUNTAIN, "\tc[\trM\tc]\tn" }, /* 5 */
{ SECT_WATER_SWIM, "\tc[\tc~\tc]\tn" },
{ SECT_WATER_NOSWIM, "\tc[\tb=\tc]\tn" },
{ SECT_FLYING, "\tc[\tC^\tc]\tn" },
{ SECT_UNDERWATER, "\tc[\tbU\tc]\tn" },
{ -1, "" }, /* 10 */
{ -1, "" },
{ -1, "" },
@ -140,22 +142,22 @@ static struct map_info_type map_info[] =
{ -1, "" },
{ -1, "" },
{ SECT_EMPTY, " " }, /* 30 */
{ SECT_STRANGE, "@c[@R?@c]@n" },
{ SECT_HERE, "@c[@B!@c]@n" },
{ SECT_STRANGE, "\tc[\tR?\tc]\tn" },
{ SECT_HERE, "\tc[\tB!\tc]\tn" },
};
static struct map_info_type world_map_info[] =
{
{ SECT_INSIDE, "@n." }, /* 0 */
{ SECT_CITY, "@wC" },
{ SECT_FIELD, "@g," },
{ SECT_FOREST, "@gY" },
{ SECT_HILLS, "@Mm" },
{ SECT_MOUNTAIN, "@rM" }, /* 5 */
{ SECT_WATER_SWIM, "@c~" },
{ SECT_WATER_NOSWIM, "@b=" },
{ SECT_FLYING, "@C^" },
{ SECT_UNDERWATER, "@bU" },
{ SECT_INSIDE, "\tn." }, /* 0 */
{ SECT_CITY, "\twC" },
{ SECT_FIELD, "\tg," },
{ SECT_FOREST, "\tgY" },
{ SECT_HILLS, "\tMm" },
{ SECT_MOUNTAIN, "\trM" }, /* 5 */
{ SECT_WATER_SWIM, "\tc~" },
{ SECT_WATER_NOSWIM, "\tb=" },
{ SECT_FLYING, "\tC^" },
{ SECT_UNDERWATER, "\tbU" },
{ -1, "" }, /* 10 */
{ -1, "" },
{ -1, "" },
@ -177,8 +179,8 @@ static struct map_info_type world_map_info[] =
{ -1, "" },
{ -1, "" },
{ SECT_EMPTY, " " }, /* 30 */
{ SECT_STRANGE, "@R?" },
{ SECT_HERE, "@B!" },
{ SECT_STRANGE, "\tR?" },
{ SECT_HERE, "\tB!" },
};
@ -415,7 +417,7 @@ static char *WorldMap(int centre, int size, int mapshape, int maptype )
strcpy(mp++, " ");
}
}
strcpy(mp, "@n\r\n");
strcpy(mp, "\tn\r\n");
mp+=4;
}
*mp='\0';
@ -466,7 +468,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
if (is_abbrev(arg2, "normal")) worldmap=FALSE;
else if (is_abbrev(arg2, "world")) worldmap=TRUE;
else {
send_to_char(ch, "Usage: @ymap <distance> [ normal | world ]@n");
send_to_char(ch, "Usage: \tymap <distance> [ normal | world ]\tn");
return;
}
}
@ -499,22 +501,22 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
map[centre][centre] = SECT_HERE;
/* Feel free to put your own MUD name or header in here */
send_to_char(ch, " @Y-@ytbaMUD Map System@Y-@n\r\n"
"@D .-.__--.,--.__.-.@n\r\n" );
send_to_char(ch, " \tY-\tytbaMUD Map System\tY-\tn\r\n"
"\tD .-.__--.,--.__.-.\tn\r\n" );
count += sprintf(buf + count, "@n@n@n%s Up\\\\", door_info[NUM_DOOR_TYPES + DOOR_UP].disp);
count += sprintf(buf + count, "@n@n@n%s Down\\\\", door_info[NUM_DOOR_TYPES + DOOR_DOWN].disp);
count += sprintf(buf + count, "@n%s You\\\\", map_info[SECT_HERE].disp);
count += sprintf(buf + count, "@n%s Inside\\\\", map_info[SECT_INSIDE].disp);
count += sprintf(buf + count, "@n%s City\\\\", map_info[SECT_CITY].disp);
count += sprintf(buf + count, "@n%s Field\\\\", map_info[SECT_FIELD].disp);
count += sprintf(buf + count, "@n%s Forest\\\\", map_info[SECT_FOREST].disp);
count += sprintf(buf + count, "@n%s Hills\\\\", map_info[SECT_HILLS].disp);
count += sprintf(buf + count, "@n%s Mountain\\\\", map_info[SECT_MOUNTAIN].disp);
count += sprintf(buf + count, "@n%s Swim\\\\", map_info[SECT_WATER_SWIM].disp);
count += sprintf(buf + count, "@n%s Boat\\\\", map_info[SECT_WATER_NOSWIM].disp);
count += sprintf(buf + count, "@n%s Flying\\\\", map_info[SECT_FLYING].disp);
count += sprintf(buf + count, "@n%s Underwater\\\\", map_info[SECT_UNDERWATER].disp);
count += sprintf(buf + count, "\tn\tn\tn%s Up\\\\", door_info[NUM_DOOR_TYPES + DOOR_UP].disp);
count += sprintf(buf + count, "\tn\tn\tn%s Down\\\\", door_info[NUM_DOOR_TYPES + DOOR_DOWN].disp);
count += sprintf(buf + count, "\tn%s You\\\\", map_info[SECT_HERE].disp);
count += sprintf(buf + count, "\tn%s Inside\\\\", map_info[SECT_INSIDE].disp);
count += sprintf(buf + count, "\tn%s City\\\\", map_info[SECT_CITY].disp);
count += sprintf(buf + count, "\tn%s Field\\\\", map_info[SECT_FIELD].disp);
count += sprintf(buf + count, "\tn%s Forest\\\\", map_info[SECT_FOREST].disp);
count += sprintf(buf + count, "\tn%s Hills\\\\", map_info[SECT_HILLS].disp);
count += sprintf(buf + count, "\tn%s Mountain\\\\", map_info[SECT_MOUNTAIN].disp);
count += sprintf(buf + count, "\tn%s Swim\\\\", map_info[SECT_WATER_SWIM].disp);
count += sprintf(buf + count, "\tn%s Boat\\\\", map_info[SECT_WATER_NOSWIM].disp);
count += sprintf(buf + count, "\tn%s Flying\\\\", map_info[SECT_FLYING].disp);
count += sprintf(buf + count, "\tn%s Underwater\\\\", map_info[SECT_UNDERWATER].disp);
strcpy(buf, strfrmt(buf, LEGEND_WIDTH, CANVAS_HEIGHT + 2, FALSE, TRUE, TRUE));
@ -522,7 +524,7 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
strcpy(buf1, strfrmt("",0, CANVAS_HEIGHT + 2, FALSE, FALSE, TRUE));
/* Paste the legend */
strcpy(buf2, strpaste(buf1, buf, "@D | @n"));
strcpy(buf2, strpaste(buf1, buf, "\tD | \tn"));
/* Set up the map */
memset(buf, ' ', CANVAS_WIDTH);
@ -534,13 +536,13 @@ static void perform_map( struct char_data *ch, char *argument, bool worldmap )
memset(buf + count, ' ', CANVAS_WIDTH);
strcpy(buf + count + CANVAS_WIDTH, "\r\n");
/* Paste it on */
strcpy(buf2, strpaste(buf2, buf, "@D | @n"));
strcpy(buf2, strpaste(buf2, buf, "\tD | \tn"));
/* Paste on the right border */
strcpy(buf2, strpaste(buf2, buf1, " "));
/* Print it all out */
send_to_char(ch, "%s", buf2);
send_to_char(ch, "@D `.-.__--.,-.__.-.-'@n\r\n");
send_to_char(ch, "\tD `.-.__--.,-.__.-.-'\tn\r\n");
return;
}
@ -556,7 +558,7 @@ void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
return;
}
worldmap = ROOM_FLAGGED(target_room, ROOM_WORLDMAP) ? TRUE : FALSE ;
worldmap = show_worldmap(ch);
if(!PRF_FLAGGED(ch, PRF_AUTOMAP)) {
send_to_char(ch, "%s", strfrmt(str, GET_SCREEN_WIDTH(ch), 1, FALSE, FALSE, FALSE));
@ -573,7 +575,7 @@ void str_and_map(char *str, struct char_data *ch, room_vnum target_room ) {
map[x][y]= (!(y%2) && !worldmap) ? DOOR_NONE : SECT_EMPTY;
/* starts the mapping with the center room */
MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldmap );
MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldmap );
map[centre][centre] = SECT_HERE;
/* char_size = rooms + doors + padding */
@ -583,13 +585,13 @@ MapArea(target_room, ch, centre, centre, min, max, ns_size/2, ew_size/2, worldma
char_size = 3*(size+1) + (size) + 4;
if(worldmap)
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " "));
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), WorldMap(centre, size, MAP_CIRCLE, MAP_COMPACT), " \tn"));
else
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), CompactStringMap(centre, size), " "));
send_to_char(ch, "%s", strpaste(strfrmt(str, GET_SCREEN_WIDTH(ch) - char_size, size*2 + 1, FALSE, TRUE, TRUE), CompactStringMap(centre, size), " \tn"));
}
bool show_worldmap(struct char_data *ch) {
static bool show_worldmap(struct char_data *ch) {
room_rnum rm = IN_ROOM(ch);
zone_rnum zn = GET_ROOM_ZONE(rm);

View file

@ -505,14 +505,14 @@ int save_config( IDXTYPE nowhere )
strip_cr(buf);
fprintf(fl, "* The entrance/exit menu.\n"
"MENU = \n%s~\n\n", buf);
"MENU = \n%s~\n\n", convert_from_tabs(buf));
}
if (CONFIG_WELC_MESSG) {
strcpy(buf, CONFIG_WELC_MESSG);
strip_cr(buf);
fprintf(fl, "* The welcome message.\nWELC_MESSG = \n%s~\n\n", buf);
fprintf(fl, "* The welcome message.\nWELC_MESSG = \n%s~\n\n", convert_from_tabs(buf));
}
if (CONFIG_START_MESSG) {
@ -520,7 +520,7 @@ int save_config( IDXTYPE nowhere )
strip_cr(buf);
fprintf(fl, "* NEWBIE start message.\n"
"START_MESSG = \n%s~\n\n", buf);
"START_MESSG = \n%s~\n\n", convert_from_tabs(buf));
}
fprintf(fl, "* Should the medit OLC show the advanced stats menu (1) or not (0).\n"

View file

@ -162,7 +162,6 @@ static sigfunc *my_signal(int signo, sigfunc *func);
#endif
/* Webster Dictionary Lookup functions */
static RETSIGTYPE websterlink(int sig);
static size_t proc_colors(char *txt, size_t maxlen, int parse);
static void handle_webster_file();
static void msdp_update(void); /* KaVir plugin*/
@ -1103,80 +1102,6 @@ void echo_on(struct descriptor_data *d)
write_to_output(d, "%s", on_string);
}
#define COLOR_ON(ch) (!IS_NPC(ch) ? (PRF_FLAGGED((ch), PRF_COLOR_1) || PRF_FLAGGED((ch), PRF_COLOR_2) ? 1 : 0) : 0)
/* Color replacement arrays. Renx -- 011100 */
#define A "\x1B["
char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0;31m",
A"0;35m",A"0;33m",A"0;37m",A"1;30m",A"1;34m",A"1;32m",A"1;36m",A"1;31m",
A"1;35m",A"1;33m",A"1;37m",A"40m",A"44m",A"42m",A"46m",A"41m",A"45m",
A"43m",A"47m",A"5m",A"4m",A"1m",A"7m"
,"!"};
#undef A
const char CCODE[] = "@nNdbgcrmywDBGCRMYW01234567luoe!";
static size_t proc_colors(char *txt, size_t maxlen, int parse)
{
char *d, *s, *p;
const char *c;
int i;
if (!txt || !strchr(txt, '@')) /* skip out if no color codes */
return strlen(txt);
s = txt;
CREATE(d, char, maxlen);
p = d;
for( ; *s && ((size_t)(d-p) < maxlen); ) {
/* no color code - just copy */
if (*s != '@') {
*d++ = *s++;
continue;
}
/* if we get here we have a color code */
s++; /* s now points to the code */
if (!*s) { /* string was terminated with @ */
*d++ = '@';
/* s will now point to '\0' in the for() check */
continue;
}
if (!parse) { /* not parsing, just skip the code, unless it's @@ */
if (*s == '@') {
*d++ = '@';
}
s++; /* skip to next (non-colorcode) char */
continue;
}
/* parse the color code */
for (i = 0; CCODE[i] != '!'; i++) { /* do we find it ? */
if ((*s) == CCODE[i]) { /* if so :*/
/* c now points to the first char in color code*/
for(c = ANSI[i] ; *c && ((size_t)(d-p) < maxlen); )
*d++ = *c++;
break;
}
}
/* If we couldn't find any correct color code let's just skip it - Welcor */
s++;
} /* for loop */
/* make sure txt is NULL - terminated */
d = '\0';
strncpy(txt, p, maxlen-1);
free(p);
return strlen(txt);
}
static char *make_prompt(struct descriptor_data *d)
{
static char prompt[MAX_PROMPT_LENGTH];
@ -1355,8 +1280,6 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
return (0);
wantsize = size = vsnprintf(txt, sizeof(txt), format, args);
if (t->character)
wantsize = size = proc_colors(txt, sizeof(txt), COLOR_ON(t->character));
strcpy(txt, ProtocolOutput( t, txt, (int*)&wantsize )); /* <--- Add this line */
size = wantsize; /* <--- Add this line */
@ -2402,7 +2325,7 @@ void game_info(const char *format, ...)
char messg[MAX_STRING_LENGTH];
if (format == NULL)
return;
sprintf(messg, "@cInfo: @y");
sprintf(messg, "\tcInfo: \ty");
for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING)
continue;
@ -2413,7 +2336,7 @@ void game_info(const char *format, ...)
va_start(args, format);
vwrite_to_output(i, format, args);
va_end(args);
write_to_output(i, "@n\r\n");
write_to_output(i, "\tn\r\n");
}
}

View file

@ -170,6 +170,7 @@ char *fread_action(FILE *fl, int nr)
if (*buf == '#')
return (NULL);
parse_at(buf);
buf[strlen(buf) - 1] = '\0';
return (strdup(buf));
}
@ -2054,6 +2055,7 @@ static void load_zones(FILE *fl, char *zonename)
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
*ptr = '\0';
Z.name = strdup(buf);
parse_at(Z.name);
/* Clear all the zone flags */
for (i=0; i<ZN_ARRAY_MAX; i++)
@ -2244,6 +2246,7 @@ void load_help(FILE * fl, char *name)
el.duplicate = 0;
el.entry = strdup(entry);
parse_at(el.entry);
scan = one_word(key, next_key);
while (*next_key) {
@ -2805,7 +2808,8 @@ char *fread_string(FILE *fl, const char *error)
length += templength;
}
} while (!done);
parse_at(buf);
/* allocate space for the new string and copy it */
return (strlen(buf) ? strdup(buf) : NULL);
}
@ -2860,7 +2864,8 @@ char *fread_clean_string(FILE *fl, const char *error)
length += templength;
}
} while (!done);
parse_at(buf);
/* allocate space for the new string and copy it */
return (strlen(buf) ? strdup(buf) : NULL);
}
@ -3280,7 +3285,9 @@ static int file_to_string_alloc(const char *name, char **buf)
if (*buf)
free(*buf);
parse_at(temp);
*buf = strdup(temp);
return (0);
}
@ -3957,6 +3964,8 @@ void load_config( void )
free(CONFIG_MENU);
strncpy(buf, "Reading menu in load_config()", sizeof(buf));
CONFIG_MENU = fread_string(fl, buf);
parse_at(CONFIG_MENU);
parse_at(CONFIG_MENU);
} else if (!str_cmp(tag, "min_rent_cost"))
CONFIG_MIN_RENT_COST = num;
else if (!str_cmp(tag, "min_wizlist_lev"))
@ -4019,6 +4028,7 @@ void load_config( void )
if (CONFIG_START_MESSG)
free(CONFIG_START_MESSG);
CONFIG_START_MESSG = fread_string(fl, buf);
parse_at(CONFIG_START_MESSG);
}
break;

View file

@ -361,13 +361,14 @@ int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{
char ldesc[MAX_STRING_LENGTH];
char ddesc[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
ldesc[MAX_STRING_LENGTH - 1] = '\0';
ddesc[MAX_STRING_LENGTH - 1] = '\0';
strip_cr(strncpy(ldesc, GET_LDESC(mob), MAX_STRING_LENGTH - 1));
strip_cr(strncpy(ddesc, GET_DDESC(mob), MAX_STRING_LENGTH - 1));
fprintf(fd, "#%d\n"
sprintf(buf, "#%d\n"
"%s%c\n"
"%s%c\n"
"%s%c\n"
@ -379,6 +380,9 @@ int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
ddesc, STRING_TERMINATOR
);
fprintf(fd, convert_from_tabs(buf), 0);
fprintf(fd, "%d %d %d %d %d %d %d %d %d E\n"
"%d %d %d %dd%d+%d %dd%d+%d\n",
MOB_FLAGS(mob)[0], MOB_FLAGS(mob)[1],

View file

@ -178,7 +178,7 @@ obj_rnum index_object(struct obj_data *obj, obj_vnum ovnum, obj_rnum ornum)
int save_objects(zone_rnum zone_num)
{
char filename[128], buf[MAX_STRING_LENGTH];
char filename[128], buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
char ebuf1[MAX_STRING_LENGTH], ebuf2[MAX_STRING_LENGTH], ebuf3[MAX_STRING_LENGTH], ebuf4[MAX_STRING_LENGTH];
char wbuf1[MAX_STRING_LENGTH], wbuf2[MAX_STRING_LENGTH], wbuf3[MAX_STRING_LENGTH], wbuf4[MAX_STRING_LENGTH];
char pbuf1[MAX_STRING_LENGTH], pbuf2[MAX_STRING_LENGTH], pbuf3[MAX_STRING_LENGTH], pbuf4[MAX_STRING_LENGTH];
@ -210,7 +210,7 @@ int save_objects(zone_rnum zone_num)
} else
*buf = '\0';
fprintf(fp,
sprintf(buf2,
"#%d\n"
"%s~\n"
"%s~\n"
@ -222,6 +222,8 @@ int save_objects(zone_rnum zone_num)
(obj->short_description && *obj->short_description) ? obj->short_description : "undefined",
(obj->description && *obj->description) ? obj->description : "undefined",
buf);
fprintf(fp, convert_from_tabs(buf2), 0);
sprintascii(ebuf1, GET_OBJ_EXTRA(obj)[0]);
sprintascii(ebuf2, GET_OBJ_EXTRA(obj)[1]);

View file

@ -70,6 +70,7 @@ static int export_info_file(zone_rnum zrnum);
int genolc_checkstring(struct descriptor_data *d, char *arg)
{
smash_tilde(arg);
parse_at(arg);
return TRUE;
}

View file

@ -179,6 +179,7 @@ int save_quests(zone_rnum zone_num)
char filename[128], oldname[128], quest_flags[MAX_STRING_LENGTH];
char quest_desc[MAX_STRING_LENGTH], quest_info[MAX_STRING_LENGTH];
char quest_done[MAX_STRING_LENGTH], quest_quit[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
int i, num_quests = 0;
#if CIRCLE_UNSIGNED_INDEX
@ -219,7 +220,7 @@ int save_quests(zone_rnum zone_num)
strip_cr(quest_quit);
/* Save the quest details to the file. */
sprintascii(quest_flags, QST_FLAGS(rnum));
fprintf(sf,
sprintf(buf,
"#%d\n"
"%s%c\n"
"%s%c\n"
@ -248,6 +249,9 @@ int save_quests(zone_rnum zone_num)
QST_RETURNMOB(rnum) == NOBODY ? -1 : QST_RETURNMOB(rnum),
QST_QUANTITY(rnum), QST_GOLD(rnum), QST_EXP(rnum), QST_OBJ(rnum)
);
fprintf(sf, convert_from_tabs(buf), 0);
num_quests++;
}
}

View file

@ -345,7 +345,7 @@ int save_shops(zone_rnum zone_num)
{
int i, j, rshop, num_shops = 0;
FILE *shop_file;
char fname[128], oldname[128];
char fname[128], oldname[128], buf[MAX_STRING_LENGTH];
struct shop_data *shop;
#if CIRCLE_UNSIGNED_INDEX
@ -391,7 +391,7 @@ int save_shops(zone_rnum zone_num)
fprintf(shop_file, "-1\n");
/* Save messages. Added some defaults as sanity checks. */
fprintf(shop_file,
sprintf(buf,
"%s~\n"
"%s~\n"
"%s~\n"
@ -415,6 +415,8 @@ int save_shops(zone_rnum zone_num)
S_KEEPER(shop) == NOBODY ? -1 : mob_index[S_KEEPER(shop)].vnum,
S_NOTRADE(shop)
);
fprintf(shop_file, convert_from_tabs(buf), 0);
/* Save the rooms. */
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++)

View file

@ -257,6 +257,7 @@ int save_rooms(zone_rnum rzone)
char filename[128];
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
#if CIRCLE_UNSIGNED_INDEX
if (rzone == NOWHERE || rzone > top_of_zone_table) {
@ -289,7 +290,7 @@ int save_rooms(zone_rnum rzone)
strip_cr(buf);
/* Save the numeric and string section of the file. */
fprintf(sf, "#%d\n"
sprintf(buf2, "#%d\n"
"%s%c\n"
"%s%c\n"
"%d %d %d %d %d %d\n",
@ -300,6 +301,8 @@ int save_rooms(zone_rnum rzone)
room->room_flags[3], room->sector_type
);
fprintf(sf, convert_from_tabs(buf2), 0);
/* Now you write out the exits for the room. */
for (j = 0; j < DIR_COUNT; j++) {
if (R_EXIT(room, j)) {

View file

@ -357,7 +357,7 @@ int save_zone(zone_rnum zone_num)
(zone_table[zone_num].builders && *zone_table[zone_num].builders)
? zone_table[zone_num].builders : "None.",
(zone_table[zone_num].name && *zone_table[zone_num].name)
? zone_table[zone_num].name : "undefined",
? convert_from_tabs(zone_table[zone_num].name) : "undefined",
genolc_zone_bottom(zone_num),
zone_table[zone_num].top,
zone_table[zone_num].lifespan,
@ -378,7 +378,7 @@ int save_zone(zone_rnum zone_num)
(zone_table[zone_num].builders && *zone_table[zone_num].builders)
? zone_table[zone_num].builders : "None.",
(zone_table[zone_num].name && *zone_table[zone_num].name)
? zone_table[zone_num].name : "undefined",
? convert_from_tabs(zone_table[zone_num].name) : "undefined",
genolc_zone_bottom(zone_num),
zone_table[zone_num].top,
zone_table[zone_num].lifespan,

View file

@ -161,7 +161,7 @@ static void hedit_save_to_disk(struct descriptor_data *d)
strip_cr(buf1);
/* Forget making a buffer, lets just write the thing now. */
fprintf(fp, "%s#%d\n", buf1, help_table[i].min_level);
fprintf(fp, "%s#%d\n", convert_from_tabs(buf1), help_table[i].min_level);
}
/* Write final line and close. */
fprintf(fp, "$~\n");

View file

@ -1639,7 +1639,7 @@ void nanny(struct descriptor_data *d, char *arg)
write_to_output(d, "%s", CONFIG_MENU);
if (IS_HAPPYHOUR > 0){
write_to_output(d, "\r\n");
write_to_output(d, "@yThere is currently a Happyhour!@n\r\n");
write_to_output(d, "\tyThere is currently a Happyhour!\tn\r\n");
write_to_output(d, "\r\n");
}
add_llog_entry(d->character, LAST_CONNECT);

View file

@ -465,7 +465,7 @@ static void medit_disp_stats_menu(struct descriptor_data *d)
clear_screen(d);
/* Color codes have to be used here, for count_color_codes to work */
sprintf(buf, "(range @y%d@n to @y%d@n)", GET_HIT(mob) + GET_MOVE(mob), (GET_HIT(mob) * GET_MANA(mob)) + GET_MOVE(mob));
sprintf(buf, "(range \ty%d\tn to \ty%d\tn)", GET_HIT(mob) + GET_MOVE(mob), (GET_HIT(mob) * GET_MANA(mob)) + GET_MOVE(mob));
/* Top section - standard stats */
write_to_output(d,

View file

@ -93,8 +93,12 @@ void parse_tab(char *str)
{
char *p = str;
for (; *p; p++)
if (*p == '\t' && *(p+1) != '\t')
*p = '@';
if (*p == '\t') {
if (*(p+1) != '\t')
*p = '@';
else
p++;
}
}
/* Basic API function to start writing somewhere. 'data' isn't used, but you
@ -123,14 +127,14 @@ void string_add(struct descriptor_data *d, char *str)
int action;
/* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' at the beginning of line. - JE */
* only accept '\t' at the beginning of line. - JE */
delete_doubledollar(str);
smash_tilde(str);
/* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' if it's by itself. - fnord */
if ((action = (*str == '@' && !str[1])))
* only accept '\t' if it's by itself. - fnord */
if ((action = (*str == '\t' && !str[1])))
*str = '\0';
else
if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
@ -409,8 +413,8 @@ static char *next_page(char *str, struct char_data *ch)
for (count=0; *str != 'm' && count < 9; count++)
str++;
else if (*str == '@') {
if (*(str + 1) != '@')
else if (*str == '\t') {
if (*(str + 1) != '\t')
str++;
}
@ -519,10 +523,10 @@ void show_string(struct descriptor_data *d, char *input)
return;
}
/* If we're displaying the last page, just send it to the character, and
* then free up the space we used. Also send a @n - to make color stop
* then free up the space we used. Also send a \tn - to make color stop
* bleeding. - Welcor */
if (d->showstr_page + 1 >= d->showstr_count) {
send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]);
send_to_char(d->character, "%s\tn", d->showstr_vector[d->showstr_page]);
free(d->showstr_vector);
d->showstr_vector = NULL;
d->showstr_count = 0;

View file

@ -364,7 +364,7 @@ void qedit_disp_flag_menu(struct descriptor_data *d)
clear_screen(d);
column_list(d->character, 0, aq_flags, NUM_AQ_FLAGS, TRUE);
sprintbit(OLC_QUEST(d)->flags, aq_flags, bits, sizeof(bits));
write_to_output(d, "\r\nQuest flags: @c%s@n\r\n"
write_to_output(d, "\r\nQuest flags: \tc%s\tn\r\n"
"Enter quest flags, 0 to quit : ", bits);
OLC_MODE(d) = QEDIT_FLAGS;
}

View file

@ -472,7 +472,7 @@ void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum v
"----- ------- -------------------------------------------- -----------\r\n");
for (rnum = 0; rnum < total_quests ; rnum++)
if (QST_NUM(rnum) >= bottom && QST_NUM(rnum) <= top)
send_to_char(ch, "@g%4d@n) [@g%-5d@n] @c%-44.44s@n @y[%5d]@n\r\n",
send_to_char(ch, "\tg%4d\tn) [\tg%-5d\tn] \tc%-44.44s\tn \ty[%5d]\tn\r\n",
++counter, QST_NUM(rnum), QST_NAME(rnum),
QST_MASTER(rnum) == NOBODY ? 0 : QST_MASTER(rnum));
if (!counter)
@ -489,11 +489,11 @@ void quest_hist(struct char_data *ch)
"----- ---------------------------------------------------- -----------\r\n");
for (i = 0; i < GET_NUM_QUESTS(ch); i++) {
if ((rnum = real_quest(ch->player_specials->saved.completed_quests[i])) != NOTHING)
send_to_char(ch, "@g%4d@n) @c%-52.52s@n @y%s@n\r\n",
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n",
++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY) ? "Unknown" : GET_NAME(&mob_proto[(real_mobile(QST_MASTER(rnum)))]));
else
send_to_char(ch,
"@g%4d@n) @cUnknown Quest (it no longer exists)@n\r\n", ++counter);
"\tg%4d\tn) \tcUnknown Quest (it no longer exists)\tn\r\n", ++counter);
}
if (!counter)
send_to_char(ch, "You haven't completed any quests yet.\r\n");
@ -567,7 +567,7 @@ void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_IN
else if ((rnum = real_quest(vnum)) == NOTHING)
send_to_char(ch, "That is not a valid quest!\r\n");
else if (QST_INFO(rnum)) {
send_to_char(ch,"Complete Details on Quest %d @c%s@n:\r\n%s",
send_to_char(ch,"Complete Details on Quest %d \tc%s\tn:\r\n%s",
vnum,
QST_DESC(rnum),
QST_INFO(rnum));
@ -644,7 +644,7 @@ void quest_show(struct char_data *ch, mob_vnum qm)
"----- ---------------------------------------------------- ------- -----\r\n");
for (rnum = 0; rnum < total_quests; rnum++)
if (qm == QST_MASTER(rnum))
send_to_char(ch, "@g%4d@n) @c%-52.52s@n @y(%5d)@n @y(%s)@n\r\n",
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty(%5d)\tn \ty(%s)\tn\r\n",
++counter, QST_DESC(rnum), QST_NUM(rnum),
(is_complete(ch, QST_NUM(rnum)) ? "Yes" : "No "));
if (!counter)
@ -695,16 +695,16 @@ void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
}
qmrnum = real_mobile(QST_MASTER(rnum));
send_to_char(ch,
"VNum : [@y%5d@n], RNum: [@y%5d@n] -- Questmaster: [@y%5d@n] @y%s@n\r\n"
"Name : @y%s@n\r\n"
"Desc : @y%s@n\r\n"
"Accept Message:\r\n@c%s@n"
"Completion Message:\r\n@c%s@n"
"Quit Message:\r\n@c%s@n"
"Type : @y%s@n\r\n"
"Target: @y%d@n @y%s@n, Quantity: @y%d@n\r\n"
"Value : @y%d@n, Penalty: @y%d@n, Min Level: @y%2d@n, Max Level: @y%2d@n\r\n"
"Flags : @c%s@n\r\n",
"VNum : [\ty%5d\tn], RNum: [\ty%5d\tn] -- Questmaster: [\ty%5d\tn] \ty%s\tn\r\n"
"Name : \ty%s\tn\r\n"
"Desc : \ty%s\tn\r\n"
"Accept Message:\r\n\tc%s\tn"
"Completion Message:\r\n\tc%s\tn"
"Quit Message:\r\n\tc%s\tn"
"Type : \ty%s\tn\r\n"
"Target: \ty%d\tn \ty%s\tn, Quantity: \ty%d\tn\r\n"
"Value : \ty%d\tn, Penalty: \ty%d\tn, Min Level: \ty%2d\tn, Max Level: \ty%2d\tn\r\n"
"Flags : \tc%s\tn\r\n",
QST_NUM(rnum), rnum,
QST_MASTER(rnum) == NOBODY ? -1 : QST_MASTER(rnum),
(qmrnum == NOBODY) ? "(Invalid vnum)" : GET_NAME(&mob_proto[(qmrnum)]),
@ -720,13 +720,13 @@ void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
QST_POINTS(rnum), QST_PENALTY(rnum), QST_MINLEVEL(rnum),
QST_MAXLEVEL(rnum), buf);
if (QST_PREREQ(rnum) != NOTHING)
send_to_char(ch, "Preq : [@y%5d@n] @y%s@n\r\n",
send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n",
QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum),
QST_PREREQ(rnum) == NOTHING ? "" :
real_object(QST_PREREQ(rnum)) == NOTHING ? "an unknown object" :
obj_proto[real_object(QST_PREREQ(rnum))].short_description);
if (QST_TYPE(rnum) == AQ_OBJ_RETURN)
send_to_char(ch, "Mob : [@y%5d@n] @y%s@n\r\n",
send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n",
QST_RETURNMOB(rnum),
real_mobile(QST_RETURNMOB(rnum)) == NOBODY ? "an unknown mob" :
mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr);
@ -738,15 +738,15 @@ void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
send_to_char(ch, "Limit : There is no time limit on this quest.\r\n");
send_to_char(ch, "Prior :");
if (QST_PREV(rnum) == NOTHING)
send_to_char(ch, " @yNone.@n\r\n");
send_to_char(ch, " \tyNone.\tn\r\n");
else
send_to_char(ch, " [@y%5d@n] @c%s@n\r\n",
send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n",
QST_PREV(rnum), QST_DESC(real_quest(QST_PREV(rnum))));
send_to_char(ch, "Next :");
if (QST_NEXT(rnum) == NOTHING)
send_to_char(ch, " @yNone.@n\r\n");
send_to_char(ch, " \tyNone.\tn\r\n");
else
send_to_char(ch, " [@y%5d@n] @c%s@n\r\n",
send_to_char(ch, " [\ty%5d\tn] \tc%s\tn\r\n",
QST_NEXT(rnum), QST_DESC(real_quest(QST_NEXT(rnum))));
}
}

View file

@ -91,8 +91,8 @@ char *CAP(char *txt)
char *p = txt;
/* Skip all preceeding color codes and ANSI codes */
while ((*p == '@' && *(p+1)) || (*p == '\x1B' && *(p+1) == '[')) {
if (*p == '@') p += 2; /* Skip @ sign and color letter/number */
while ((*p == '\t' && *(p+1)) || (*p == '\x1B' && *(p+1) == '[')) {
if (*p == '\t') p += 2; /* Skip @ sign and color letter/number */
else {
p += 2; /* Skip the CSI section of the ANSI code */
while (*p && !isalpha(*p)) p++; /* Skip until a 'letter' is found */
@ -809,9 +809,8 @@ int count_color_chars(char *string)
len = strlen(string);
for (i = 0; i < len; i++) {
while (string[i] == '\t' || string[i] == '@') {
if ((string[i] == '\t' && string[i + 1] == '\t') ||
(string[i] == '@' && string[i + 1] == '@'))
while (string[i] == '\t') {
if (string[i + 1] == '\t')
num++;
else
num += 2;
@ -1299,7 +1298,7 @@ IDXTYPE atoidx( const char *str_to_conv )
Re-formats a string to fit within a particular size box.
Recognises @ color codes, and if a line ends in one color, the
next line will start with the same color.
Ends every line with @n to prevent color bleeds.
Ends every line with \tn to prevent color bleeds.
*/
char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
{
@ -1341,16 +1340,14 @@ char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad)
llen = 0;
lcount++;
lp = line;
} else if (*sp=='`'||*sp=='$'||*sp=='#'||*sp=='@') {
} else if (*sp=='`'||*sp=='$'||*sp=='#') {
if (sp[1] && (sp[1]==*sp))
wlen++; /* One printable char here */
if (*sp=='@' && (sp[1]!=*sp)) /* Color code, not @@ */
last_color = sp[1];
sp += 2; /* Eat the whole code regardless */
} else if (*sp=='\t'&&sp[1]) {
char MXPcode = sp[1]=='[' ? ']' : sp[1]=='<' ? '>' : '\0';
if (!MXPcode)
if (!MXPcode)
last_color = sp[1];
sp += 2; /* Eat the code */
@ -1495,3 +1492,16 @@ int get_class_by_name(char *classname)
return (-1);
}
char * convert_from_tabs(char * string)
{
static char buf[MAX_STRING_LENGTH * 8];
strcpy(buf, string);
parse_tab(buf);
if (strchr(buf, '\t'))
mudlog(CMP, LVL_GOD, TRUE, "STILL TABS?! [%s]", buf);
return(buf);
}

View file

@ -68,6 +68,7 @@ char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad);
char *strpaste(char *str1, char *str2, char *joiner);
void new_affect(struct affected_type *af);
int get_class_by_name(char *classname);
char * convert_from_tabs(char * string);
/* Public functions made available form weather.c */
void weather_and_time(int mode);

View file

@ -379,7 +379,7 @@ void zedit_disp_flag_menu(struct descriptor_data *d)
column_list(d->character, 0, zone_bits, NUM_ZONE_FLAGS, TRUE);
sprintbitarray(OLC_ZONE(d)->zone_flags, zone_bits, ZN_ARRAY_MAX, bits);
write_to_output(d, "\r\nZone flags: @c%s@n\r\n"
write_to_output(d, "\r\nZone flags: \tc%s\tn\r\n"
"Enter Zone flags, 0 to quit : ", bits);
OLC_MODE(d) = ZEDIT_ZONE_FLAGS;
}
@ -699,13 +699,13 @@ void zedit_disp_levels(struct descriptor_data *d)
clear_screen(d);
write_to_output(d,
"\r\n"
"@y1@n) Set minimum level recommendation\r\n"
"@y2@n) Set maximum level recommendation\r\n"
"@y3@n) Clear level recommendations\r\n\r\n"
"@y0@n) Quit to main menu\r\n"
"@gCurrent Setting: %s%s\r\n"
"\ty1\tn) Set minimum level recommendation\r\n"
"\ty2\tn) Set maximum level recommendation\r\n"
"\ty3\tn) Clear level recommendations\r\n\r\n"
"\ty0\tn) Quit to main menu\r\n"
"\tgCurrent Setting: %s%s\r\n"
"\r\n"
"Enter choice (0 to quit): ", levels_set ? "@c" : "@y", lev_string
"Enter choice (0 to quit): ", levels_set ? "\tc" : "\ty", lev_string
);
OLC_MODE(d) = ZEDIT_LEVELS;
}