diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-27 06:38:17 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-27 06:38:17 +0000 |
commit | 3c8999edce9e1f0d5c0dee3ff8311e781d64c684 (patch) | |
tree | d066567a720e5fad02e6f857d55bc165d9a3809a /src/map/pc.c | |
parent | ea320701794515d4ffa6a8e8ff8f3b8fdfe09860 (diff) | |
download | hercules-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/pc.c')
-rw-r--r-- | src/map/pc.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 2c78d3370..bde039c83 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1133,7 +1133,7 @@ static int pc_bonus_autospell_del(struct s_autospell *spell, int max, short id, rate-= spell[i].rate; spell[i].rate = 0; memmove(&spell[i], &spell[j], sizeof(struct s_autospell)); - memset(&spell[j], 0, sizeof(struct s_autospell)); + malloc_set(&spell[j], 0, sizeof(struct s_autospell)); j--; } else { spell[i].rate -= rate; @@ -2688,7 +2688,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type) if(sd->status.inventory[n].amount<=0){ if(sd->status.inventory[n].equip) pc_unequipitem(sd,n,3); - memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0])); + malloc_set(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0])); sd->inventory_data[n] = NULL; } if(!(type&1)) @@ -3029,7 +3029,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type) sd->status.cart[n].amount -= amount; sd->cart_weight -= itemdb_weight(sd->status.cart[n].nameid)*amount ; if(sd->status.cart[n].amount <= 0){ - memset(&sd->status.cart[n],0,sizeof(sd->status.cart[0])); + malloc_set(&sd->status.cart[n],0,sizeof(sd->status.cart[0])); sd->cart_num--; } if(!type) { @@ -3187,7 +3187,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl) md->state.steal_flag = UCHAR_MAX; //you can't steal from this mob any more - memset(&tmp_item,0,sizeof(tmp_item)); + malloc_set(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = itemid; tmp_item.amount = 1; tmp_item.identify = itemdb_isidentified(itemid); @@ -4885,7 +4885,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) /* if(sd->status.karma > 0) { int eq_num=0,eq_n[MAX_INVENTORY]; - memset(eq_n,0,sizeof(eq_n)); + malloc_set(eq_n,0,sizeof(eq_n)); for(i=0;i<MAX_INVENTORY;i++){ int k; for(k=0;k<MAX_INVENTORY;k++){ @@ -4911,7 +4911,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) || (battle_config.bone_drop==1 && map[sd->bl.m].flag.pvp)) { struct item item_tmp; - memset(&item_tmp,0,sizeof(item_tmp)); + malloc_set(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid=7420; //PVP Skull item ID item_tmp.identify=1; item_tmp.card[0]=CARD0_CREATE; @@ -4993,7 +4993,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) continue; if(id == -1){ int eq_num=0,eq_n[MAX_INVENTORY]; - memset(eq_n,0,sizeof(eq_n)); + malloc_tsetdword(eq_n,0,sizeof(eq_n)); for(i=0;i<MAX_INVENTORY;i++){ int k; if( (type == 1 && !sd->status.inventory[i].equip) @@ -5775,7 +5775,7 @@ int pc_setreg(struct map_session_data *sd,int reg,int val) } sd->reg_num++; sd->reg = (struct script_reg *) aRealloc(sd->reg, sizeof(*(sd->reg)) * sd->reg_num); - memset(sd->reg + (sd->reg_num - 1), 0, sizeof(struct script_reg)); + malloc_set(sd->reg + (sd->reg_num - 1), 0, sizeof(struct script_reg)); sd->reg[i].index = reg; sd->reg[i].data = val; @@ -5825,7 +5825,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str) ShowFatalError("out of memory : pc_setreg\n"); exit(1); } - memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr)); + malloc_set(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr)); sd->regstr[i].index = reg; strcpy(sd->regstr[i].data, str); @@ -5953,7 +5953,7 @@ int pc_setregistry(struct map_session_data *sd,char *reg,int val,int type) { if (strcmp(sd_reg[i].str, reg) == 0) { if (i != *max - 1) memcpy(&sd_reg[i], &sd_reg[*max - 1], sizeof(struct global_reg)); - memset(&sd_reg[*max - 1], 0, sizeof(struct global_reg)); + malloc_tsetdword(&sd_reg[*max - 1], 0, sizeof(struct global_reg)); (*max)--; sd->state.reg_dirty |= 1<<(type-1); //Mark this registry as "need to be saved" break; @@ -5972,7 +5972,7 @@ int pc_setregistry(struct map_session_data *sd,char *reg,int val,int type) { // add value if not found if (i < regmax) { - memset(&sd_reg[i], 0, sizeof(struct global_reg)); + malloc_tsetdword(&sd_reg[i], 0, sizeof(struct global_reg)); strncpy(sd_reg[i].str, reg, 32); sprintf(sd_reg[i].value, "%d", val); (*max)++; @@ -6028,7 +6028,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type) if (strcmp(sd_reg[i].str, reg) == 0) { if (i != *max - 1) memcpy(&sd_reg[i], &sd_reg[*max - 1], sizeof(struct global_reg)); - memset(&sd_reg[*max - 1], 0, sizeof(struct global_reg)); + malloc_tsetdword(&sd_reg[*max - 1], 0, sizeof(struct global_reg)); (*max)--; sd->state.reg_dirty |= 1<<(type-1); //Mark this registry as "need to be saved" if (type!=3) intif_saveregistry(sd,type); @@ -6049,7 +6049,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type) // add value if not found if (i < regmax) { - memset(&sd_reg[i], 0, sizeof(struct global_reg)); + malloc_tsetdword(&sd_reg[i], 0, sizeof(struct global_reg)); strncpy(sd_reg[i].str, reg, 32); strncpy(sd_reg[i].value, val, 256); (*max)++; @@ -6482,7 +6482,7 @@ int pc_checkitem(struct map_session_data *sd) j++; } if(j < MAX_INVENTORY) - memset(&sd->status.inventory[j],0,sizeof(struct item)*(MAX_INVENTORY-j)); + malloc_set(&sd->status.inventory[j],0,sizeof(struct item)*(MAX_INVENTORY-j)); for(k=j;k<MAX_INVENTORY;k++) sd->inventory_data[k] = NULL; @@ -6502,7 +6502,7 @@ int pc_checkitem(struct map_session_data *sd) j++; } if(j < MAX_CART) - memset(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j)); + malloc_set(&sd->status.cart[j],0,sizeof(struct item)*(MAX_CART-j)); // ? 備位置チェック @@ -7021,8 +7021,8 @@ int pc_readdb(void) char line[24000],*p; // 必要??値?み?み - memset(exp_table,0,sizeof(exp_table)); - memset(max_level,0,sizeof(max_level)); + malloc_tsetword(exp_table,0,sizeof(exp_table)); + malloc_tsetword(max_level,0,sizeof(max_level)); sprintf(line, "%s/exp.txt", db_path); fp=fopen(line, "r"); if(fp==NULL){ @@ -7095,7 +7095,7 @@ int pc_readdb(void) ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","exp.txt"); // スキルツリ? - memset(skill_tree,0,sizeof(skill_tree)); + malloc_set(skill_tree,0,sizeof(skill_tree)); sprintf(line, "%s/skill_tree.txt", db_path); fp=fopen(line,"r"); if(fp==NULL){ @@ -7189,7 +7189,7 @@ int pc_readdb(void) ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","attr_fix.txt"); // スキルツリ? - memset(statp,0,sizeof(statp)); + malloc_set(statp,0,sizeof(statp)); i=1; j=45; // base points sprintf(line, "%s/statpoint.txt", db_path); @@ -7225,7 +7225,7 @@ int pc_read_motd(void) { FILE *fp; int ln=0,i=0; - memset(motd_text,0,sizeof(motd_text)); + malloc_set(motd_text,0,sizeof(motd_text)); if ((fp = fopen(motd_txt, "r")) != NULL) { while ((ln < MOTD_LINE_SIZE) && fgets(motd_text[ln], sizeof(motd_text[ln])-1, fp) != NULL) { if(motd_text[ln][0] == '/' && motd_text[ln][1] == '/') |