From a2dc72e6f957f8e44713eaedd93fd32b69f360fa Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 24 Oct 2013 11:56:53 -0700 Subject: Show level of GM commands in @help --- src/map/atcommand.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 403520e..c8826f7 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -356,6 +356,19 @@ int atcommand_config_read(ZString cfgName) /// @ command processing functions +static +void atc_do_help(const int fd, const char *cmd, const AtCommandInfo& info) +{ + auto msg = STRPRINTF("\u2007\u2007%d: @%s %s", info.level, cmd, info.args); + // manually padding because *space* + size_t ll = 1; + if (info.level >= 10) + ++ll; + if (info.level >= 100) + ++ll; + clif_displaymessage(fd, msg.xslice_t((ll - 1) * 3)); +} + static ATCE atcommand_help(const int fd, dumb_ptr, ZString message) @@ -386,7 +399,7 @@ ATCE atcommand_help(const int fd, dumb_ptr, { const char *cmd = &*pair.first.begin(); const AtCommandInfo& info = pair.second; - clif_displaymessage(fd, STRPRINTF("@%s %s", cmd, info.args)); + atc_do_help(fd, cmd, info); } return ATCE::OKAY; } @@ -405,7 +418,7 @@ ATCE atcommand_help(const int fd, dumb_ptr, const char *cmd = &*pair.first.begin(); const AtCommandInfo& info = pair.second; if (low <= info.level && info.level < high) - clif_displaymessage(fd, STRPRINTF("@%s %s", cmd, info.args)); + atc_do_help(fd, cmd, info); } return ATCE::OKAY; } -- cgit v1.2.3-60-g2f50