summaryrefslogtreecommitdiff
path: root/src/map/charcommand.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 06:38:17 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-27 06:38:17 +0000
commit3c8999edce9e1f0d5c0dee3ff8311e781d64c684 (patch)
treed066567a720e5fad02e6f857d55bc165d9a3809a /src/map/charcommand.c
parentea320701794515d4ffa6a8e8ff8f3b8fdfe09860 (diff)
downloadhercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.gz
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.bz2
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.tar.xz
hercules-3c8999edce9e1f0d5c0dee3ff8311e781d64c684.zip
* Optional macro MEMSET_TURBO for faster low-level memory initializations.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8499 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/charcommand.c')
-rw-r--r--src/map/charcommand.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 740f7465d..66905faba 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -138,7 +138,7 @@ is_charcommand(const int fd, struct map_session_data* sd, const char* message, i
if (!message || !*message)
return CharCommand_None;
- memset(&info, 0, sizeof(info));
+ malloc_set(&info, 0, sizeof(info));
str += strlen(sd->status.name);
while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) {
if (*str == ':')
@@ -162,8 +162,8 @@ is_charcommand(const int fd, struct map_session_data* sd, const char* message, i
char command[100];
char output[200];
const char* p = str;
- memset(command, '\0', sizeof(command));
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(command, '\0', sizeof(command));
+ malloc_tsetdword(output, '\0', sizeof(output));
while (*p && !isspace(*p))
p++;
if (p - str >= sizeof(command)) // too long
@@ -208,7 +208,7 @@ CharCommandType charcommand(struct map_session_data* sd, const int level, const
if (*p == command_symbol) { // check first char.
char command[101];
int i = 0;
- memset(info, 0, sizeof(CharCommandInfo));
+ malloc_set(info, 0, sizeof(CharCommandInfo));
sscanf(p, "%100s", command);
command[sizeof(command)-1] = '\0';
@@ -307,7 +307,7 @@ int charcommand_jobchange(
struct map_session_data* pl_sd;
int job = 0, upper = -1;
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a job and a player name (usage: #job/#jobchange <job ID> <char name>).");
@@ -364,7 +364,7 @@ int charcommand_petrename(
struct map_session_data *pl_sd;
struct pet_data *pd;
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #petrename <char name>).");
@@ -408,7 +408,7 @@ int charcommand_petfriendly(
struct map_session_data *pl_sd;
struct pet_data *pd;
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message,"%d %23s",&friendly,character) < 2) {
clif_displaymessage(fd, "Please, enter a valid value (usage: "
"#petfriendly <0-1000> <player>).");
@@ -459,9 +459,9 @@ int charcommand_stats(
struct map_session_data *pl_sd;
int i;
- memset(character, '\0', sizeof(character));
- memset(job_jobname, '\0', sizeof(job_jobname));
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(character, '\0', sizeof(character));
+ malloc_tsetdword(job_jobname, '\0', sizeof(job_jobname));
+ malloc_tsetdword(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #stats <char name>).");
@@ -530,8 +530,8 @@ int charcommand_reset(
char output[200];
struct map_session_data *pl_sd;
- memset(character, '\0', sizeof(character));
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(character, '\0', sizeof(character));
+ malloc_tsetdword(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #reset <charname>).");
@@ -568,7 +568,7 @@ int charcommand_option(
int opt1 = 0, opt2 = 0, opt3 = 0;
struct map_session_data* pl_sd;
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message ||
sscanf(message, "%d %d %d %23[^\n]", &opt1, &opt2, &opt3, character) < 4 ||
@@ -609,8 +609,8 @@ int charcommand_save(
int x = 0, y = 0;
int m;
- memset(map_name, '\0', sizeof(map_name));
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(map_name, '\0', sizeof(map_name));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%15s %d %d %23[^\n]", map_name, &x, &y, character) < 4 || x < 0 || y < 0) {
clif_displaymessage(fd, "Please, enter a valid save point and a player name (usage: #save <map> <x> <y> <charname>).");
@@ -662,8 +662,8 @@ int charcommand_stats_all(const int fd, struct map_session_data* sd, const char*
int count, users;
struct map_session_data *pl_sd, **pl_allsd;
- memset(output, '\0', sizeof(output));
- memset(gmlevel, '\0', sizeof(gmlevel));
+ malloc_tsetdword(output, '\0', sizeof(output));
+ malloc_tsetdword(gmlevel, '\0', sizeof(gmlevel));
count = 0;
pl_allsd = map_getallusers(&users);
@@ -706,7 +706,7 @@ int charcommand_spiritball(const int fd, struct map_session_data* sd,const char*
char character[NAME_LENGTH];
int spirit = 0;
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if(!message || !*message || sscanf(message, "%d %23[^\n]", &spirit, character) < 2 || spirit < 0 || spirit > 1000) {
clif_displaymessage(fd, "Usage: @spiritball <number: 0-1000>) <CHARACTER_NAME>.");
@@ -754,10 +754,10 @@ charcommand_itemlist(
struct item *i_item; //Current inventory item.
nullpo_retr(-1, sd);
- memset(character, '\0', sizeof(character));
- memset(output, '\0', sizeof(output));
- memset(equipstr, '\0', sizeof(equipstr));
- memset(outputtmp, '\0', sizeof(outputtmp));
+ malloc_tsetdword(character, '\0', sizeof(character));
+ malloc_tsetdword(output, '\0', sizeof(output));
+ malloc_tsetdword(equipstr, '\0', sizeof(equipstr));
+ malloc_tsetdword(outputtmp, '\0', sizeof(outputtmp));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <char name>).");
@@ -810,13 +810,13 @@ charcommand_itemlist(
// remove final ', '
equipstr[strlen(equipstr) - 2] = '\0';
} else
- memset(equipstr, '\0', sizeof(equipstr));
+ malloc_tsetdword(equipstr, '\0', sizeof(equipstr));
if (i_item->refine)
sprintf(output, "%d %s %+d (%s %+d, id: %d) %s", i_item->amount, item_data->name, i_item->refine, item_data->jname, i_item->refine, i_item->nameid, equipstr);
else
sprintf(output, "%d %s (%s, id: %d) %s", i_item->amount, item_data->name, item_data->jname, i_item->nameid, equipstr);
clif_displaymessage(fd, output);
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(output, '\0', sizeof(output));
counter2 = 0;
if(i_item->card[0]==CARD0_PET) { //pet eggs
@@ -914,9 +914,9 @@ charcommand_storagelist(
char character[NAME_LENGTH], output[200], outputtmp[200];
nullpo_retr(-1, sd);
- memset(character, '\0', sizeof(character));
- memset(output, '\0', sizeof(output));
- memset(outputtmp, '\0', sizeof(outputtmp));
+ malloc_tsetdword(character, '\0', sizeof(character));
+ malloc_tsetdword(output, '\0', sizeof(output));
+ malloc_tsetdword(outputtmp, '\0', sizeof(outputtmp));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #itemlist <char name>).");
@@ -941,7 +941,7 @@ charcommand_storagelist(
else
sprintf(output, "%d %s (%s, id: %d)", stor->storage_[i].amount, item_data->name, item_data->jname, stor->storage_[i].nameid);
clif_displaymessage(fd, output);
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(output, '\0', sizeof(output));
counter2 = 0;
for (j = 0; j < item_data->slot; j++) {
if (stor->storage_[i].card[j]) {
@@ -997,7 +997,7 @@ charcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data
get_count = 1;
}
for (i = 0; i < loop; i++) {
- memset(&item_tmp, 0, sizeof(item_tmp));
+ malloc_set(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_data->nameid;
item_tmp.identify = 1;
@@ -1030,7 +1030,7 @@ int charcommand_item(
char tmp_cmdoutput[1024];
nullpo_retr(-1, sd);
- memset(item_name, '\0', sizeof(item_name));
+ malloc_tsetdword(item_name, '\0', sizeof(item_name));
if (!message || !*message || sscanf(message, "%99s %d %23[^\n]", item_name, &number, character) < 3) {
clif_displaymessage(fd, "Please, enter an item name/id (usage: #item <item name or ID> <quantity> <char name>).");
@@ -1065,7 +1065,7 @@ int charcommand_item(
100, 0, 1, pet_db[pet_id].jname);
// if not pet egg
} else {
- memset(&item_tmp, 0, sizeof(item_tmp));
+ malloc_set(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
@@ -1124,8 +1124,8 @@ int charcommand_warp(
nullpo_retr(-1, sd);
- memset(map_name, '\0', sizeof(map_name));
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(map_name, '\0', sizeof(map_name));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%15s %d %d %23[^\n]", map_name, &x, &y, character) < 4) {
clif_displaymessage(fd, "Usage: #warp/#rura/#rura+ <mapname> <x> <y> <char name>");
@@ -1182,7 +1182,7 @@ int charcommand_zeny(
int zeny = 0, new_zeny;
nullpo_retr(-1, sd);
- memset(character, '\0', sizeof(character));
+ malloc_tsetdword(character, '\0', sizeof(character));
if (!message || !*message || sscanf(message, "%d %23[^\n]", &zeny, character) < 2 || zeny == 0) {
clif_displaymessage(fd, "Please, enter a number and a player name (usage: #zeny <zeny> <name>).");
@@ -1766,8 +1766,8 @@ int charcommand_feelreset(
char output[200];
struct map_session_data *pl_sd;
- memset(character, '\0', sizeof(character));
- memset(output, '\0', sizeof(output));
+ malloc_tsetdword(character, '\0', sizeof(character));
+ malloc_tsetdword(output, '\0', sizeof(output));
if (!message || !*message || sscanf(message, "%23[^\n]", character) < 1) {
clif_displaymessage(fd, "Please, enter a player name (usage: #feelreset <charname>).");
@@ -1804,7 +1804,7 @@ int charcommand_help(
FILE* fp;
nullpo_retr(-1, sd);
- memset(buf, '\0', sizeof(buf));
+ malloc_tsetdword(buf, '\0', sizeof(buf));
if ((fp = fopen(charhelp_txt, "r")) != NULL) {
clif_displaymessage(fd, msg_table[26]); /* Help commands: */