diff --git a/src/act.h b/src/act.h index 3750e92..37b8de9 100644 --- a/src/act.h +++ b/src/act.h @@ -64,7 +64,6 @@ void free_recent_players(void); ACMD(do_commands); #define SCMD_COMMANDS 0 #define SCMD_SOCIALS 1 -#define SCMD_WIZHELP 2 /* do_gen_ps */ ACMD(do_gen_ps); #define SCMD_INFO 0 @@ -340,6 +339,7 @@ ACMD(do_teleport); ACMD(do_trans); ACMD(do_vnum); ACMD(do_vstat); +ACMD(do_wizhelp); ACMD(do_wizlock); ACMD(do_wiznet); ACMD(do_wizupdate); diff --git a/src/act.informative.c b/src/act.informative.c index 902d3d4..06363ac 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -2210,35 +2210,17 @@ ACMD(do_toggle) ACMD(do_commands) { int no, i, cmd_num; - int wizhelp = 0, socials = 0; - struct char_data *vict; - char arg[MAX_INPUT_LENGTH]; - char buf[MAX_STRING_LENGTH]; + int socials = 0; const char *commands[1000]; int overflow = sizeof(commands) / sizeof(commands[0]); if (!ch->desc) return; - one_argument(argument, arg); - - if (*arg) { - if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD)) || IS_NPC(vict)) { - send_to_char(ch, "Who is that?\r\n"); - return; - } - } else - vict = ch; - if (subcmd == SCMD_SOCIALS) socials = 1; - else if (subcmd == SCMD_WIZHELP) - wizhelp = 1; - sprintf(buf, "The following %s%s are available to %s:\r\n", - wizhelp ? "privileged " : "", - socials ? "socials" : "commands", - vict == ch ? "you" : GET_NAME(vict)); + send_to_char(ch, "The following %s are available to you:\r\n", socials ? "socials" : "commands"); /* cmd_num starts at 1, not 0, to remove 'RESERVED' */ for (no = 0, cmd_num = 1; @@ -2250,13 +2232,10 @@ ACMD(do_commands) if (complete_cmd_info[i].minimum_level < 0 || GET_LEVEL(vict) < complete_cmd_info[i].minimum_level) continue; - if ((complete_cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp) + if (complete_cmd_info[i].minimum_level >= LVL_IMMORT) continue; - if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action)) - continue; - - if (wizhelp && complete_cmd_info[i].command_pointer == do_action) + if (socials != (complete_cmd_info[i].command_pointer == do_action)) continue; if (--overflow < 0) diff --git a/src/act.wizard.c b/src/act.wizard.c index c89575f..0c72be1 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -89,6 +89,34 @@ static int purge_room(room_rnum room) return 1; } +ACMD(do_wizhelp) +{ + extern int *cmd_sort_info; + int no = 1, i, cmd_num; + int level; + + if (!ch->desc) + return; + + send_to_char(ch, "The following privileged commands are available:\r\n"); + + for (level = LVL_IMPL; level >= LVL_IMMORT; level--) { + send_to_char(ch, "%sLevel %d%s:\r\n", CCCYN(ch, C_NRM), level, CCNRM(ch, C_NRM)); + for (no = 1, cmd_num = 1; complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; cmd_num++) { + i = cmd_sort_info[cmd_num]; + + if (complete_cmd_info[i].minimum_level != level) + continue; + + send_to_char(ch, "%-14s%s", complete_cmd_info[i].command, no++ % 7 == 0 ? "\r\n" : ""); + } + if (no % 7 != 1) + send_to_char(ch, "\r\n"); + if (level != LVL_IMMORT) + send_to_char(ch, "\r\n"); + } +} + ACMD(do_echo) { skip_spaces(&argument); diff --git a/src/interpreter.c b/src/interpreter.c index 7e1c1cc..872aab1 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -349,7 +349,7 @@ cpp_extern const struct command_info cmd_info[] = { { "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, 0 }, { "wiznet" , "wiz" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, { ";" , ";" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 }, - { "wizhelp" , "wizhelp" , POS_SLEEPING, do_commands , LVL_IMMORT, SCMD_WIZHELP }, + { "wizhelp" , "wizhelp" , POS_DEAD , do_wizhelp , LVL_IMMORT, 0 }, { "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST }, { "wizupdate", "wizupde" , POS_DEAD , do_wizupdate, LVL_GRGOD, 0 }, { "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 }, diff --git a/src/utils.c b/src/utils.c index 834790e..c3cf3c1 100644 --- a/src/utils.c +++ b/src/utils.c @@ -961,6 +961,7 @@ void column_list(struct char_data *ch, int num_cols, const char **list, int list int num_per_col, col_width, r, c, i, offset = 0; char buf[MAX_STRING_LENGTH]; + *buf='\0'; /* Work out the longest list item */ for (i=0; i