Vatiken wrote: The issue with this is if someone attempts to connect using a client without ANSI support. What occurs on their screen may range from nothing, to a blurb of weird characters, to a client crash/disconnect.
I'd be interested to see your "case CON_QCLASS:" in interpreter.c, and your "class_menu[]" in class.c, to see if I can't figure out what's happening.
Code:
const char *class_menu =
"\r\n"
"\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n"
" \x1B[47m| Class Selection \x1B[47m|\x1B[0;0m\r\n"
"\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n"
" \x1B[47m| A) Knight \x1B[47m|\x1B[0;0m\r\n"
" \x1B[47m| B) Mage \x1B[47m|\x1B[0;0m\r\n"
" \x1B[47m| C) Priest \x1B[47m|\x1B[0;0m\r\n"
" \x1B[47m| D) Thief \x1B[47m|\x1B[0;0m\r\n"
"\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n"
" \x1B[47m| Z) toggle between\x1B[47m|\x1B[0;0m\r\n"
" \x1B[47m| class selection \x1B[47m|\x1B[0;0m\r\n"
" \x1B[47m| and help menu. \x1B[47m|\x1B[0;0m\r\n"
"\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[1;37m----------------\x1B[1;30m(\x1B[1;31m*\x1B[1;30m)\x1B[0;0m\r\n";
Code:
case CON_QCLASS:
if(!strcmp(arg, "z") || !strcmp(arg, "Z")) {
write_to_output(d, "%s\r\nClass Help: ", class_menu);
STATE(d) = CON_QCLASS_HELP;
return;
}
load_result = parse_class(*arg);
if (load_result == CLASS_UNDEFINED) {
write_to_output(d, "\r\nThat's not a class.\r\nClass: ");
return;
} else
GET_CLASS(d->character) = load_result;
if (d->olc) {
free(d->olc);
d->olc = NULL;
}
if (GET_PFILEPOS(d->character) < 0)
GET_PFILEPOS(d->character) = create_entry(GET_PC_NAME(d->character));
/* Now GET_NAME() will work properly. */
init_char(d->character);
save_char(d->character);
save_player_index();
write_to_output(d, "%s\r\n*** PRESS RETURN: ", motd);
STATE(d) = CON_RMOTD;
/* make sure the last log is updated correctly. */
GET_PREF(d->character)= rand_number(1, 128000);
GET_HOST(d->character)= strdup(d->host);
mudlog(NRM, LVL_GOD, TRUE, "%s [%s] new player.", GET_NAME(d->character), d->host);
/* Add to the list of 'recent' players (since last reboot) */
if (AddRecentPlayer(GET_NAME(d->character), d->host, TRUE, FALSE) == FALSE)
{
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
}
break;
You can ignore the color code for now
thats just a temp fix, but I did post what you asked for.