mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-22 10:10:13 +01:00
Cedit Toggle for enabling colour codes in the comm channels
This commit is contained in:
parent
fdff4c8aa7
commit
2c0cca1f50
7 changed files with 62 additions and 3 deletions
|
|
@ -22,6 +22,21 @@
|
|||
#include "act.h"
|
||||
#include "modify.h"
|
||||
|
||||
static bool legal_communication(char * arg);
|
||||
|
||||
static bool legal_communication(char * arg)
|
||||
{
|
||||
while (*arg) {
|
||||
if (*arg == '@') {
|
||||
arg++;
|
||||
if (*arg == '(' || *arg == ')' || *arg == '<' || *arg == '>')
|
||||
return FALSE;
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ACMD(do_say)
|
||||
{
|
||||
skip_spaces(&argument);
|
||||
|
|
@ -32,6 +47,9 @@ ACMD(do_say)
|
|||
char buf[MAX_INPUT_LENGTH + 14], *msg;
|
||||
struct char_data *vict;
|
||||
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(argument);
|
||||
|
||||
snprintf(buf, sizeof(buf), "$n\tn says, '%s'", argument);
|
||||
msg = act(buf, FALSE, ch, 0, 0, TO_ROOM | DG_NO_TRIG);
|
||||
|
||||
|
|
@ -69,6 +87,9 @@ ACMD(do_gsay)
|
|||
else {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(argument);
|
||||
|
||||
if (ch->master)
|
||||
k = ch->master;
|
||||
else
|
||||
|
|
@ -182,8 +203,11 @@ ACMD(do_tell)
|
|||
send_to_char(ch, "%s", CONFIG_NOPERSON);
|
||||
else if (GET_LEVEL(ch) >= LVL_IMMORT && !(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
||||
send_to_char(ch, "%s", CONFIG_NOPERSON);
|
||||
else if (is_tell_ok(ch, vict))
|
||||
else if (is_tell_ok(ch, vict)) {
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(buf2);
|
||||
perform_tell(ch, vict, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
ACMD(do_reply)
|
||||
|
|
@ -211,9 +235,12 @@ ACMD(do_reply)
|
|||
|
||||
if (!tch)
|
||||
send_to_char(ch, "They are no longer playing.\r\n");
|
||||
else if (is_tell_ok(ch, tch))
|
||||
else if (is_tell_ok(ch, tch)) {
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(argument);
|
||||
perform_tell(ch, tch, argument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ACMD(do_spec_comm)
|
||||
|
|
@ -253,6 +280,9 @@ ACMD(do_spec_comm)
|
|||
else {
|
||||
char buf1[MAX_STRING_LENGTH];
|
||||
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(buf2);
|
||||
|
||||
snprintf(buf1, sizeof(buf1), "$n %s you, '%s'", action_plur, buf2);
|
||||
act(buf1, FALSE, ch, 0, vict, TO_VICT);
|
||||
|
||||
|
|
@ -493,6 +523,9 @@ ACMD(do_gen_comm)
|
|||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
|
||||
send_to_char(ch, "%s", CONFIG_OK);
|
||||
else {
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(argument);
|
||||
|
||||
snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "",
|
||||
com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
|
||||
|
||||
|
|
@ -536,6 +569,9 @@ ACMD(do_qcomm)
|
|||
char buf[MAX_STRING_LENGTH];
|
||||
struct descriptor_data *i;
|
||||
|
||||
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
|
||||
parse_at(argument);
|
||||
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
|
||||
send_to_char(ch, "%s", CONFIG_OK);
|
||||
else if (subcmd == SCMD_QSAY) {
|
||||
|
|
|
|||
15
src/cedit.c
15
src/cedit.c
|
|
@ -131,6 +131,7 @@ static void cedit_setup(struct descriptor_data *d)
|
|||
OLC_CONFIG(d)->operation.medit_advanced = CONFIG_MEDIT_ADVANCED;
|
||||
OLC_CONFIG(d)->operation.ibt_autosave = CONFIG_IBT_AUTOSAVE;
|
||||
OLC_CONFIG(d)->operation.protocol_negotiation = CONFIG_PROTOCOL_NEGOTIATION;
|
||||
OLC_CONFIG(d)->operation.special_in_comm = CONFIG_SPECIAL_IN_COMM;
|
||||
|
||||
/* Autowiz */
|
||||
OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ;
|
||||
|
|
@ -232,6 +233,7 @@ static void cedit_save_internally(struct descriptor_data *d)
|
|||
CONFIG_MEDIT_ADVANCED = OLC_CONFIG(d)->operation.medit_advanced;
|
||||
CONFIG_IBT_AUTOSAVE = OLC_CONFIG(d)->operation.ibt_autosave;
|
||||
CONFIG_PROTOCOL_NEGOTIATION = OLC_CONFIG(d)->operation.protocol_negotiation;
|
||||
CONFIG_SPECIAL_IN_COMM = OLC_CONFIG(d)->operation.special_in_comm;
|
||||
|
||||
/* Autowiz */
|
||||
CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz;
|
||||
|
|
@ -542,10 +544,14 @@ int save_config( IDXTYPE nowhere )
|
|||
"min_wizlist_lev = %d\n\n",
|
||||
CONFIG_MIN_WIZLIST_LEV);
|
||||
|
||||
fprintf(fl, "* If yes, enable the protocol negotiation system?\n"
|
||||
fprintf(fl, "* If yes, enable the protocol negotiation system.\n"
|
||||
"protocol_negotiation = %d\n\n",
|
||||
CONFIG_PROTOCOL_NEGOTIATION);
|
||||
|
||||
fprintf(fl, "* If yes, enable the special character in comm channels.\n"
|
||||
"special_in_comm = %d\n\n",
|
||||
CONFIG_SPECIAL_IN_COMM);
|
||||
|
||||
fclose(fl);
|
||||
|
||||
if (in_save_list(NOWHERE, SL_CFG))
|
||||
|
|
@ -731,6 +737,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
|
|||
"%sO%s) Medit Stats Menu : %s%s\r\n"
|
||||
"%sP%s) Autosave bugs when resolved from commandline : %s%s\r\n"
|
||||
"%sR%s) Enable Protocol Negotiation : %s%s\r\n"
|
||||
"%sS%s) Enable Special Char in Comm : %s%s\r\n"
|
||||
"%sQ%s) Exit To The Main Menu\r\n"
|
||||
"Enter your choice : ",
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.DFLT_PORT,
|
||||
|
|
@ -750,6 +757,7 @@ static void cedit_disp_operation_options(struct descriptor_data *d)
|
|||
grn, nrm, cyn, OLC_CONFIG(d)->operation.medit_advanced ? "Advanced" : "Standard",
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.ibt_autosave ? "Yes" : "No",
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.protocol_negotiation ? "Yes" : "No",
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->operation.special_in_comm ? "Yes" : "No",
|
||||
grn, nrm
|
||||
);
|
||||
|
||||
|
|
@ -1228,6 +1236,11 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||
TOGGLE_VAR(OLC_CONFIG(d)->operation.protocol_negotiation);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
case 'S':
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->operation.special_in_comm);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
case 'Q':
|
||||
cedit_disp_menu(d);
|
||||
|
|
|
|||
|
|
@ -311,3 +311,6 @@ int ibt_autosave = YES;
|
|||
|
||||
/* Use the protocol negotiation system */
|
||||
int protocol_negotiation = YES;
|
||||
|
||||
/* Use the special character in communication channels */
|
||||
int special_in_comm = YES;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ extern int use_autowiz;
|
|||
extern int min_wizlist_lev;
|
||||
extern int display_closed_doors;
|
||||
extern int protocol_negotiation;
|
||||
extern int special_in_comm;
|
||||
/* Automap and map options */
|
||||
extern int map_option;
|
||||
extern int default_map_size;
|
||||
|
|
|
|||
3
src/db.c
3
src/db.c
|
|
@ -3766,6 +3766,7 @@ static void load_default_config( void )
|
|||
CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort;
|
||||
CONFIG_DISP_CLOSED_DOORS = display_closed_doors;
|
||||
CONFIG_PROTOCOL_NEGOTIATION = protocol_negotiation;
|
||||
CONFIG_SPECIAL_IN_COMM = special_in_comm;
|
||||
CONFIG_DIAGONAL_DIRS = diagonal_dirs;
|
||||
CONFIG_MAP = map_option;
|
||||
CONFIG_MAP_SIZE = default_map_size;
|
||||
|
|
@ -4026,6 +4027,8 @@ void load_config( void )
|
|||
CONFIG_SITEOK_ALL = num;
|
||||
else if (!str_cmp(tag, "script_players"))
|
||||
CONFIG_SCRIPT_PLAYERS = num;
|
||||
else if (!str_cmp(tag, "special_in_comm"))
|
||||
CONFIG_SPECIAL_IN_COMM = num;
|
||||
else if (!str_cmp(tag, "start_messg")) {
|
||||
strncpy(buf, "Reading start message in load_config()", sizeof(buf));
|
||||
if (CONFIG_START_MESSG)
|
||||
|
|
|
|||
|
|
@ -1349,6 +1349,7 @@ struct game_operation
|
|||
int medit_advanced; /**< Does the medit OLC show the advanced stats menu ? */
|
||||
int ibt_autosave; /**< Does "bug resolve" autosave ? */
|
||||
int protocol_negotiation; /**< Enable the protocol negotiation system ? */
|
||||
int special_in_comm; /**< Enable use of a special character in communication channels ? */
|
||||
};
|
||||
|
||||
/** The Autowizard options. */
|
||||
|
|
|
|||
|
|
@ -1048,6 +1048,8 @@ do \
|
|||
#define CONFIG_IBT_AUTOSAVE config_info.operation.ibt_autosave
|
||||
/** Use the protocol negotiation system? */
|
||||
#define CONFIG_PROTOCOL_NEGOTIATION config_info.operation.protocol_negotiation
|
||||
/** Use the special character in comm channels? */
|
||||
#define CONFIG_SPECIAL_IN_COMM config_info.operation.special_in_comm
|
||||
|
||||
/* Autowiz */
|
||||
/** Use autowiz or not? */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue