summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 97e90efda..8c38374ef 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -261,7 +261,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m,
{
struct spawn_data data;
- memset(&data, 0, sizeof(struct spawn_data));
+ malloc_set(&data, 0, sizeof(struct spawn_data));
data.m = m;
data.num = 1;
data.class_ = class_;
@@ -450,7 +450,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname,
struct guild *g=NULL;
struct guild_castle *gc;
int m, count;
- memset(&data, 0, sizeof(struct spawn_data));
+ malloc_set(&data, 0, sizeof(struct spawn_data));
data.num = 1;
if( sd && strcmp(mapname,"this")==0)
@@ -655,7 +655,7 @@ int mob_spawn (struct mob_data *md)
}
}
}
- memset(&md->state, 0, sizeof(md->state));
+ malloc_set(&md->state, 0, sizeof(md->state));
status_calc_mob(md, 1);
md->attacked_id = 0;
md->attacked_players = 0;
@@ -674,10 +674,10 @@ int mob_spawn (struct mob_data *md)
for (i = 0, c = tick-1000*3600*10; i < MAX_MOBSKILL; i++)
md->skilldelay[i] = c;
- memset(md->dmglog, 0, sizeof(md->dmglog));
+ malloc_set(md->dmglog, 0, sizeof(md->dmglog));
md->tdmg = 0;
if (md->lootitem)
- memset(md->lootitem, 0, sizeof(md->lootitem));
+ malloc_set(md->lootitem, 0, sizeof(md->lootitem));
md->lootitem_count = 0;
if(md->db->option)
@@ -1418,7 +1418,7 @@ static int mob_ai_hard(int tid,unsigned int tick,int id,int data)
static struct item_drop* mob_setdropitem(int nameid, int qty)
{
struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop);
- memset(&drop->item_data, 0, sizeof(struct item));
+ malloc_set(&drop->item_data, 0, sizeof(struct item));
drop->item_data.nameid = nameid;
drop->item_data.amount = qty;
drop->item_data.identify = itemdb_isidentified(nameid);
@@ -1723,8 +1723,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
map_freeblock_lock();
- memset(tmpbl,0,sizeof(tmpbl));
- memset(pt,0,sizeof(pt));
+ malloc_tsetdword(tmpbl,0,sizeof(tmpbl));
+ malloc_set(pt,0,sizeof(pt));
if(src && src->type == BL_MOB)
mob_unlocktarget((struct mob_data *)src,tick);
@@ -2075,7 +2075,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(temp <= rand()%10000+1) //if ==0, then it doesn't drop
continue;
- memset(&item,0,sizeof(item));
+ malloc_set(&item,0,sizeof(item));
item.nameid=md->db->mvpitem[i].nameid;
item.identify= itemdb_isidentified(item.nameid);
clif_mvp_item(mvp_sd,item.nameid);
@@ -2288,7 +2288,7 @@ int mob_class_change (struct mob_data *md, int class_)
status_calc_mob(md, 3);
if (battle_config.monster_class_change_full_recover) {
- memset(md->dmglog, 0, sizeof(md->dmglog));
+ malloc_set(md->dmglog, 0, sizeof(md->dmglog));
md->tdmg = 0;
} else {
md->status.hp = md->status.max_hp*hp_rate/100;
@@ -2392,7 +2392,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id)
nullpo_retr(0, md2);
nullpo_retr(0, value);
- memset(&data, 0, sizeof(struct spawn_data));
+ malloc_set(&data, 0, sizeof(struct spawn_data));
data.m = md2->bl.m;
data.x = md2->bl.x;
data.y = md2->bl.y;
@@ -2893,7 +2893,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char
skill_get_unit_flag(skill_id)&(UF_NOMOB|UF_NOPC))
continue;
- memset (&ms[i], 0, sizeof(struct mob_skill));
+ malloc_set (&ms[i], 0, sizeof(struct mob_skill));
ms[i].skill_id = skill_id;
ms[i].skill_lv = sd->status.skill[skill_id].lv;
ms[i].state = MSS_ANY;
@@ -3419,7 +3419,7 @@ static int mob_readdb_mobavail(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- memset(str,0,sizeof(str));
+ malloc_tsetdword(str,0,sizeof(str));
for(j=0,p=line;j<12;j++){
if((np=strchr(p,','))!=NULL){
@@ -3444,7 +3444,7 @@ static int mob_readdb_mobavail(void)
if(k < 0)
continue;
- memset(&mob_db_data[class_]->vd, 0, sizeof(struct view_data));
+ malloc_set(&mob_db_data[class_]->vd, 0, sizeof(struct view_data));
mob_db_data[class_]->vd.class_=k;
//Player sprites
@@ -3498,7 +3498,7 @@ static int mob_read_randommonster(void)
int class_,per;
if(line[0] == '/' && line[1] == '/')
continue;
- memset(str,0,sizeof(str));
+ malloc_tsetdword(str,0,sizeof(str));
for(j=0,p=line;j<3 && p;j++){
str[j]=p;
p=strchr(p,',');
@@ -3623,7 +3623,7 @@ static int mob_readskilldb(void)
if(line[0] == '/' && line[1] == '/')
continue;
- memset(sp,0,sizeof(sp));
+ malloc_tsetdword(sp,0,sizeof(sp));
for(i=0,p=line;i<18 && p;i++){
sp[i]=p;
if((p=strchr(p,','))!=NULL)
@@ -3646,14 +3646,14 @@ static int mob_readskilldb(void)
if( strcmp(sp[1],"clear")==0 ){
if (mob_id < 0)
continue;
- memset(mob_db_data[mob_id]->skill,0,sizeof(struct mob_skill));
+ malloc_set(mob_db_data[mob_id]->skill,0,sizeof(struct mob_skill));
mob_db_data[mob_id]->maxskill=0;
continue;
}
if (mob_id < 0)
{ //Prepare global skill. [Skotlex]
- memset(&gms, 0, sizeof (struct mob_skill));
+ malloc_set(&gms, 0, sizeof (struct mob_skill));
ms = &gms;
} else {
for(i=0;i<MAX_MOBSKILL;i++)
@@ -3788,7 +3788,7 @@ static int mob_readdb_race(void)
while(fgets(line,1020,fp)){
if(line[0]=='/' && line[1]=='/')
continue;
- memset(str,0,sizeof(str));
+ malloc_tsetdword(str,0,sizeof(str));
for(j=0,p=line;j<12;j++){
if((np=strchr(p,','))!=NULL){
@@ -4099,7 +4099,7 @@ void mob_reload(void)
for (i = 0; i < MAX_MOB_DB; i++)
if (mob_db_data[i])
{
- memset(&mob_db_data[i]->skill,0,sizeof(mob_db_data[i]->skill));
+ malloc_set(&mob_db_data[i]->skill,0,sizeof(mob_db_data[i]->skill));
mob_db_data[i]->maxskill=0;
}
mob_readskilldb();
@@ -4112,7 +4112,7 @@ void mob_reload(void)
*/
int do_init_mob(void)
{ //Initialize the mob database
- memset(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
+ malloc_set(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
mob_db_data[0] = aCalloc(1, sizeof (struct mob_data)); //This mob is used for random spawns
mob_makedummymobdb(0); //The first time this is invoked, it creates the dummy mob
item_drop_ers = ers_new((uint32)sizeof(struct item_drop));