diff options
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0d1c8f9d9..3eb0c37ac 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1150,7 +1150,7 @@ ACMD_FUNC(storage) { nullpo_retr(-1, sd); - if (sd->npc_id || sd->vender_id || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) + if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) return -1; if (storage_storageopen(sd) == 1) @@ -1177,7 +1177,7 @@ ACMD_FUNC(guildstorage) return -1; } - if (sd->npc_id || sd->vender_id || sd->state.buyingstore || sd->state.trading) + if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading) return -1; if (sd->state.storage_flag == 1) { @@ -2462,7 +2462,7 @@ ACMD_FUNC(monster) if (number <= 0) number = 1; - if (strlen(name) < 1) + if( !name[0] ) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive @@ -2543,7 +2543,7 @@ ACMD_FUNC(monstersmall) if (number <= 0) number = 1; - if (strlen(name) < 1) + if( !name[0] ) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive @@ -2619,7 +2619,7 @@ ACMD_FUNC(monsterbig) if (number <= 0) number = 1; - if (strlen(name) < 1) + if( !name[0] ) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive @@ -6030,7 +6030,7 @@ ACMD_FUNC(autotrade) return -1; } - if( !sd->vender_id && !sd->state.buyingstore ) { //check if player is vending or buying + if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying clif_displaymessage(fd, msg_txt(549)); // "You should have a shop open to use @autotrade." return -1; } @@ -6068,7 +6068,7 @@ ACMD_FUNC(changegm) return -1; } - if (strlen(message)==0) + if( !message[0] ) { clif_displaymessage(fd, "Command usage: @changegm <guildmember name>"); return -1; @@ -6091,7 +6091,7 @@ ACMD_FUNC(changeleader) { nullpo_retr(-1, sd); - if (strlen(message)==0) + if( !message[0] ) { clif_displaymessage(fd, "Command usage: @changeleader <party member name>"); return -1; @@ -7829,31 +7829,32 @@ ACMD_FUNC(monsterignore) *------------------------------------------*/ ACMD_FUNC(fakename) { - char name[NAME_LENGTH]; nullpo_retr(-1, sd); - - if((!message || !*message) && strlen(sd->fakename) > 1) { - sd->fakename[0]='\0'; - clif_charnameack(0, &sd->bl); - clif_displaymessage(sd->fd,"Returned to real name."); - return 0; - } - if (!message || !*message || sscanf(message, "%23[^\n]", name) < 1) { - clif_displaymessage(sd->fd,"You must enter a name."); + if( !message || !*message ) + { + if( sd->fakename[0] ) + { + sd->fakename[0] = '\0'; + clif_charnameack(0, &sd->bl); + clif_displaymessage(sd->fd, "Returned to real name."); + return 0; + } + + clif_displaymessage(sd->fd, "You must enter a name."); return -1; } - if(strlen(name) < 2) { - clif_displaymessage(sd->fd,"Fake name must be at least two characters."); + if( strlen(message) < 2 ) + { + clif_displaymessage(sd->fd, "Fake name must be at least two characters."); return -1; } - memcpy(sd->fakename,name,NAME_LENGTH); - sd->fakename[NAME_LENGTH-1] = '\0'; + safestrncpy(sd->fakename, message, sizeof(sd->fakename)); clif_charnameack(0, &sd->bl); - clif_displaymessage(sd->fd,"Fake name enabled."); - + clif_displaymessage(sd->fd, "Fake name enabled."); + return 0; } @@ -7987,7 +7988,7 @@ ACMD_FUNC(duel) return 0; } - if(strlen(message) > 0) { + if( message[0] ) { if(sscanf(message, "%d", &maxpl) >= 1) { if(maxpl < 2 || maxpl > 65535) { clif_displaymessage(fd, msg_txt(357)); // "Duel: Invalid value." @@ -8163,7 +8164,7 @@ ACMD_FUNC(clone) *-----------------------------------*/ ACMD_FUNC(main) { - if(strlen(message) > 0) { + if( message[0] ) { if(strcmpi(message, "on") == 0) { if(!sd->state.mainchat) { @@ -9249,7 +9250,7 @@ ACMD_FUNC(commands) if( gm_lvl < atcommand_info[i].level2 && stristr(command,"charcommands") ) continue; - slen = (unsigned int)strlen(atcommand_info[i].command); + slen = strlen(atcommand_info[i].command); // flush the text buffer if this command won't fit into it if( slen + cur - line_buff >= CHATBOX_SIZE ) |