summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-12 01:14:19 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-12 01:14:19 +0000
commit697869d09139d11c3662700c7a23ae8e8e513a21 (patch)
tree8244157bff8cbef53fc7c121c0bbaa88b4c3dce1 /src/map/atcommand.c
parentaace438194ba1da0b99ed68ae2568a67c212782c (diff)
downloadhercules-697869d09139d11c3662700c7a23ae8e8e513a21.tar.gz
hercules-697869d09139d11c3662700c7a23ae8e8e513a21.tar.bz2
hercules-697869d09139d11c3662700c7a23ae8e8e513a21.tar.xz
hercules-697869d09139d11c3662700c7a23ae8e8e513a21.zip
fixed bug with aliases of the @commands command from working properly; bugfix by xantara. bugreport:5225
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15434 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f27fa0026..1e8c80136 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -67,7 +67,7 @@ typedef struct AtCommandInfo {
static AtCommandInfo* get_atcommandinfo_byname(const char* name);
ACMD_FUNC(commands);
-
+ACMD_FUNC(charcommands);
/*=========================================
* Generic variables
@@ -9050,7 +9050,7 @@ void atcommand_basecommands(void) {
{ "itemlist", 40,40, atcommand_itemlist },
{ "stats", 40,40, atcommand_stats },
{ "delitem", 60,60, atcommand_delitem },
- { "charcommands", 1,1, atcommand_commands },
+ { "charcommands", 1,1, atcommand_charcommands },
{ "font", 1,1, atcommand_font },
/**
* For Testing Purposes, not going to be here after we're done.
@@ -9387,10 +9387,9 @@ void do_final_atcommand() {
// commands that need to go _after_ the commands table
/*==========================================
- * @commands Lists available @ commands to you
+ * type: 1 = commands (@), 2 = charcommands (#)
*------------------------------------------*/
-ACMD_FUNC(commands)
-{
+static void atcommand_commands_sub(struct map_session_data* sd, const int fd, int type) {
char line_buff[CHATBOX_SIZE];
int gm_lvl = pc_isGM(sd), count = 0;
char* cur = line_buff;
@@ -9405,9 +9404,9 @@ ACMD_FUNC(commands)
for( cmd = (AtCommandInfo*)iter->first(iter,NULL); iter->exists(iter); cmd = (AtCommandInfo*)iter->next(iter,NULL) ) {
unsigned int slen;
- if( gm_lvl < cmd->level && stristr(command,"commands") )
+ if( type == 1 && gm_lvl < cmd->level )
continue;
- if( gm_lvl < cmd->level2 && stristr(command,"charcommands") )
+ if( type == 2 && gm_lvl < cmd->level2 )
continue;
slen = strlen(cmd->command);
@@ -9432,5 +9431,23 @@ ACMD_FUNC(commands)
sprintf(atcmd_output, msg_txt(274), count); // "%d commands found."
clif_displaymessage(fd, atcmd_output);
+ return;
+}
+
+/*==========================================
+ * @commands Lists available @ commands to you
+ *------------------------------------------*/
+ACMD_FUNC(commands)
+{
+ atcommand_commands_sub(sd, fd, 1);
+ return 0;
+ }
+
+/*==========================================
+ * @charcommands Lists available # commands to you
+ *------------------------------------------*/
+ACMD_FUNC(charcommands)
+{
+ atcommand_commands_sub(sd, fd, 2);
return 0;
}