summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c4
-rw-r--r--src/map/battle.c58
-rw-r--r--src/map/battleground.c2
-rw-r--r--src/map/clif.c118
-rw-r--r--src/map/guild.c4
-rw-r--r--src/map/map.c6
-rw-r--r--src/map/mob.c6
-rw-r--r--src/map/party.c4
-rw-r--r--src/map/pc.c4
-rw-r--r--src/map/script.c17
-rw-r--r--src/map/skill.c17
-rw-r--r--src/map/status.c86
-rw-r--r--src/map/unit.c19
13 files changed, 176 insertions, 169 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index b508c9adb..59c889f55 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6081,7 +6081,7 @@ ACMD(mobsearch)
it = mapit_geteachmob();
for(;;)
{
- TBL_MOB* md = (TBL_MOB*)mapit->next(it);
+ struct mob_data *md = (struct mob_data *)mapit->next(it);
if( md == NULL )
break;// no more mobs
@@ -6775,7 +6775,7 @@ ACMD(showmobs)
it = mapit_geteachmob();
for(;;)
{
- TBL_MOB* md = (TBL_MOB*)mapit->next(it);
+ struct mob_data *md = (struct mob_data *)mapit->next(it);
if( md == NULL )
break;// no more mobs
diff --git a/src/map/battle.c b/src/map/battle.c
index 1eec1f14a..ded0ecac9 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3070,7 +3070,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
int i;
if (sc->data[SC_MANU_DEF] != NULL) {
for (i = 0; i < ARRAYLENGTH(mob->manuk); i++) {
- if (mob->manuk[i] == ((TBL_MOB*)src)->class_) {
+ if (mob->manuk[i] == ((struct mob_data *)src)->class_) {
damage -= damage * sc->data[SC_MANU_DEF]->val1 / 100;
break;
}
@@ -3078,7 +3078,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
}
if (sc->data[SC_SPL_DEF] != NULL) {
for (i = 0; i < ARRAYLENGTH(mob->splendide); i++) {
- if (mob->splendide[i] == ((TBL_MOB*)src)->class_) {
+ if (mob->splendide[i] == ((struct mob_data *)src)->class_) {
damage -= damage * sc->data[SC_SPL_DEF]->val1 / 100;
break;
}
@@ -3086,7 +3086,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
}
if (sc->data[SC_MORA_BUFF] != NULL) {
for (i = 0; i < ARRAYLENGTH(mob->mora); i++) {
- if (mob->mora[i] == ((TBL_MOB*)src)->class_) {
+ if (mob->mora[i] == ((struct mob_data *)src)->class_) {
damage -= damage * sc->data[SC_MORA_BUFF]->val1 / 100;
break;
}
@@ -3227,7 +3227,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
((sce=tsc->data[SC_MANU_MATK]) && (flag&BF_MAGIC))
)
for (i=0;ARRAYLENGTH(mob->manuk)>i;i++)
- if (((TBL_MOB*)bl)->class_==mob->manuk[i]) {
+ if (((struct mob_data *)bl)->class_ == mob->manuk[i]) {
damage += damage * sce->val1 / 100;
break;
}
@@ -3235,7 +3235,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
((sce=tsc->data[SC_SPL_MATK]) && (flag&BF_MAGIC))
)
for (i=0;ARRAYLENGTH(mob->splendide)>i;i++)
- if (((TBL_MOB*)bl)->class_==mob->splendide[i]) {
+ if (((struct mob_data *)bl)->class_ == mob->splendide[i]) {
damage += damage * sce->val1 / 100;
break;
}
@@ -3301,9 +3301,9 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( bl->type == BL_MOB && !status->isdead(bl) && src != bl) {
if ( damage > 0 )
- mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),flag);
+ mob->skill_event((struct mob_data *)bl, src, timer->gettick(), flag);
if (skill_id)
- mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),MSC_SKILLUSED|(skill_id<<16));
+ mob->skill_event((struct mob_data *)bl, src, timer->gettick(), MSC_SKILLUSED|(skill_id<<16));
}
if (sd && pc_ismadogear(sd) && rnd()%100 < 50) {
int element = -1;
@@ -3701,9 +3701,11 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
for(i = 0; i < map->list[target->m].zone->capped_skills_count; i++) {
if( skill_id == map->list[target->m].zone->capped_skills[i]->nameid && (map->list[target->m].zone->capped_skills[i]->type & target->type) ) {
if( target->type == BL_MOB && map->list[target->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
- if( (((TBL_MOB*)target)->status.mode&MD_BOSS) && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ if ((((struct mob_data *)target)->status.mode&MD_BOSS)
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS))
continue;
- if( ((TBL_MOB*)target)->special_state.clone && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ if (((struct mob_data *)target)->special_state.clone
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE))
continue;
}
if( ad.damage > map->list[target->m].zone->capped_skills[i]->cap )
@@ -4175,9 +4177,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
for(i = 0; i < map->list[target->m].zone->capped_skills_count; i++) {
if( skill_id == map->list[target->m].zone->capped_skills[i]->nameid && (map->list[target->m].zone->capped_skills[i]->type & target->type) ) {
if( target->type == BL_MOB && map->list[target->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
- if( (((TBL_MOB*)target)->status.mode&MD_BOSS) && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ if ((((struct mob_data *)target)->status.mode&MD_BOSS)
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS))
continue;
- if( ((TBL_MOB*)target)->special_state.clone && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ if (((struct mob_data *)target)->special_state.clone
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE))
continue;
}
if( md.damage > map->list[target->m].zone->capped_skills[i]->cap )
@@ -5394,9 +5398,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
for(i = 0; i < map->list[target->m].zone->capped_skills_count; i++) {
if( skill_id == map->list[target->m].zone->capped_skills[i]->nameid && (map->list[target->m].zone->capped_skills[i]->type & target->type) ) {
if( target->type == BL_MOB && map->list[target->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
- if( (((TBL_MOB*)target)->status.mode&MD_BOSS) && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ if ((((struct mob_data *)target)->status.mode&MD_BOSS)
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS))
continue;
- if( ((TBL_MOB*)target)->special_state.clone && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ if (((struct mob_data *)target)->special_state.clone
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE))
continue;
}
if( wd.damage > map->list[target->m].zone->capped_skills[i]->cap )
@@ -5651,9 +5657,11 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
for(i = 0; i < map->list[target->m].zone->capped_skills_count; i++) {
if( skill_id == map->list[target->m].zone->capped_skills[i]->nameid && (map->list[target->m].zone->capped_skills[i]->type & target->type) ) {
if( target->type == BL_MOB && map->list[target->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
- if( (((TBL_MOB*)target)->status.mode&MD_BOSS) && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ if ((((struct mob_data *)target)->status.mode&MD_BOSS)
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_BOSS))
continue;
- if( ((TBL_MOB*)target)->special_state.clone && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ if (((struct mob_data *)target)->special_state.clone
+ && !(map->list[target->m].zone->disabled_skills[i]->subtype&MZS_CLONE))
continue;
}
if( d.damage > map->list[target->m].zone->capped_skills[i]->cap )
@@ -5970,7 +5978,7 @@ int battle_damage_area(struct block_list *bl, va_list ap) {
amotion=va_arg(ap,int);
dmotion=va_arg(ap,int);
damage=va_arg(ap,int);
- if (bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPELIUM)
+ if (bl->type == BL_MOB && ((struct mob_data *)bl)->class_ == MOBID_EMPELIUM)
return 0;
if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) {
nullpo_ret(src);
@@ -6384,8 +6392,8 @@ struct block_list* battle_get_master(struct block_list *src) {
src = (struct block_list*)((TBL_PET*)src)->msd;
break;
case BL_MOB:
- if (((TBL_MOB*)src)->master_id)
- src = map->id2bl(((TBL_MOB*)src)->master_id);
+ if (((struct mob_data *)src)->master_id != 0)
+ src = map->id2bl(((struct mob_data *)src)->master_id);
break;
case BL_HOM:
if (((TBL_HOM*)src)->master)
@@ -6481,7 +6489,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
break;
case BL_MOB:
{
- TBL_MOB *md = BL_CAST(BL_MOB, target);
+ struct mob_data *md = BL_CAST(BL_MOB, target);
if((
(md->special_state.ai == AI_SPHERE || (md->special_state.ai == AI_FLORA && battle_config.summon_flora&1))
&& s_bl->type == BL_PC && src->type != BL_MOB
@@ -6597,7 +6605,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case BL_PET:
if (t_bl->type != BL_MOB && flag&BCT_ENEMY)
return 0; //Pet may not attack non-mobs.
- if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->guardian_data && flag&BCT_ENEMY)
+ if (t_bl->type == BL_MOB && ((struct mob_data *)t_bl)->guardian_data && flag&BCT_ENEMY)
return 0; //pet may not attack Guardians/Emperium
break;
case BL_SKILL: {
@@ -6621,7 +6629,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
}
break;
case BL_MER:
- if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->class_ == MOBID_EMPELIUM && flag&BCT_ENEMY)
+ if (t_bl->type == BL_MOB && ((struct mob_data *)t_bl)->class_ == MOBID_EMPELIUM && flag&BCT_ENEMY)
return 0; //mercenary may not attack Emperium
break;
} //end switch actual src
@@ -6643,7 +6651,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
return 0;
}
}
- if (map_flag_gvg(m) && !sd->status.guild_id && t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->class_ == MOBID_EMPELIUM)
+ if (map_flag_gvg(m) && !sd->status.guild_id && t_bl->type == BL_MOB && ((struct mob_data *)t_bl)->class_ == MOBID_EMPELIUM)
return 0; //If you don't belong to a guild, can't target emperium.
if( t_bl->type != BL_PC )
state |= BCT_ENEMY; //Natural enemy.
@@ -6659,13 +6667,13 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
if (md->special_state.ai == AI_NONE) {
//Normal mobs
struct mob_data *target_md = BL_CAST(BL_MOB, target);
- if( (target_md && t_bl->type == BL_PC && target_md->special_state.ai != AI_ZANZOU && target_md->special_state.ai != AI_ATTACK)
- || (t_bl->type == BL_MOB && !((TBL_MOB*)t_bl)->special_state.ai) )
+ if ((target_md != NULL && t_bl->type == BL_PC && target_md->special_state.ai != AI_ZANZOU && target_md->special_state.ai != AI_ATTACK)
+ || (t_bl->type == BL_MOB && !((struct mob_data *)t_bl)->special_state.ai))
state |= BCT_PARTY; //Normal mobs with no ai are friends.
else
state |= BCT_ENEMY; //However, all else are enemies.
} else {
- if (t_bl->type == BL_MOB && ((TBL_MOB*)t_bl)->special_state.ai == AI_NONE)
+ if (t_bl->type == BL_MOB && ((struct mob_data *)t_bl)->special_state.ai == AI_NONE)
state |= BCT_ENEMY; //Natural enemy for AI mobs are normal mobs.
}
break;
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 05db70604..799a502d4 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -228,7 +228,7 @@ int bg_team_get_id(struct block_list *bl) {
case BL_MOB:
{
struct map_session_data *msd;
- struct mob_data *md = (TBL_MOB*)bl;
+ struct mob_data *md = (struct mob_data *)bl;
if (md->special_state.ai != AI_NONE && (msd = map->id2sd(md->master_id)) != NULL)
return msd->bg_id;
return md->bg_id;
diff --git a/src/map/clif.c b/src/map/clif.c
index 8928b447c..fa4d2f0bf 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1052,7 +1052,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
- p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
+ p.isBoss = (((struct mob_data *)bl)->spawn != NULL && ((struct mob_data *)bl)->spawn->state.boss) ? 1 : 0;
} else {
p.maxHP = -1;
p.HP = -1;
@@ -1191,7 +1191,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
- p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
+ p.isBoss = (((struct mob_data *)bl)->spawn != NULL && ((struct mob_data *)bl)->spawn->state.boss) ? 1 : 0;
} else {
p.maxHP = -1;
p.HP = -1;
@@ -1281,7 +1281,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) {
p.maxHP = status_get_max_hp(bl);
p.HP = status_get_hp(bl);
- p.isBoss = ( ((TBL_MOB*)bl)->spawn && ((TBL_MOB*)bl)->spawn->state.boss ) ? 1 : 0;
+ p.isBoss = (((struct mob_data*)bl)->spawn != NULL && ((struct mob_data *)bl)->spawn->state.boss) ? 1 : 0;
} else {
p.maxHP = -1;
p.HP = -1;
@@ -1444,13 +1444,13 @@ bool clif_spawn(struct block_list *bl)
}
break;
case BL_MOB:
- {
- TBL_MOB *md = ((TBL_MOB*)bl);
- if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
- clif->specialeffect(&md->bl,423,AREA);
- else if(md->special_state.size==SZ_MEDIUM)
- clif->specialeffect(&md->bl,421,AREA);
- }
+ {
+ struct mob_data *md = ((struct mob_data *)bl);
+ if (md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
+ clif->specialeffect(&md->bl,423,AREA);
+ else if (md->special_state.size==SZ_MEDIUM)
+ clif->specialeffect(&md->bl,421,AREA);
+ }
break;
case BL_NPC:
{
@@ -1699,13 +1699,13 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u
}
break;
case BL_MOB:
- {
- TBL_MOB *md = ((TBL_MOB*)bl);
- if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
- clif->specialeffect(&md->bl,423,AREA);
- else if(md->special_state.size==SZ_MEDIUM)
- clif->specialeffect(&md->bl,421,AREA);
- }
+ {
+ struct mob_data *md = ((struct mob_data *)bl);
+ if (md->special_state.size == SZ_BIG) // tiny/big mobs [Valaris]
+ clif->specialeffect(&md->bl,423,AREA);
+ else if (md->special_state.size == SZ_MEDIUM)
+ clif->specialeffect(&md->bl,421,AREA);
+ }
break;
case BL_PET:
if( vd->head_bottom ) // needed to display pet equip properly
@@ -4212,24 +4212,24 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
}
break;
case BL_MOB:
- {
- TBL_MOB* md = (TBL_MOB*)bl;
- if(md->special_state.size==SZ_BIG) // tiny/big mobs [Valaris]
- clif->specialeffect_single(bl,423,sd->fd);
- else if(md->special_state.size==SZ_MEDIUM)
- clif->specialeffect_single(bl,421,sd->fd);
+ {
+ struct mob_data *md = (struct mob_data *)bl;
+ if (md->special_state.size == SZ_BIG) // tiny/big mobs [Valaris]
+ clif->specialeffect_single(bl,423,sd->fd);
+ else if (md->special_state.size == SZ_MEDIUM)
+ clif->specialeffect_single(bl,421,sd->fd);
#if (PACKETVER >= 20120404 && PACKETVER < 20131223)
- if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) {
- int i;
- for(i = 0; i < DAMAGELOG_SIZE; i++) {// must show hp bar to all char who already hit the mob.
- if (md->dmglog[i].id == sd->status.char_id) {
- clif->monster_hp_bar(md, sd);
- break;
- }
+ if (battle_config.show_monster_hp_bar && !(md->status.mode&MD_BOSS)) {
+ int i;
+ for (i = 0; i < DAMAGELOG_SIZE; i++) {// must show hp bar to all char who already hit the mob.
+ if (md->dmglog[i].id == sd->status.char_id) {
+ clif->monster_hp_bar(md, sd);
+ break;
}
}
-#endif
}
+#endif
+ }
break;
case BL_PET:
if (vd->head_bottom)
@@ -8421,39 +8421,35 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), ((TBL_NPC*)bl)->name, NAME_LENGTH);
break;
case BL_MOB:
- {
- struct mob_data *md = (struct mob_data *)bl;
- nullpo_retv(md);
+ {
+ struct mob_data *md = (struct mob_data *)bl;
+ nullpo_retv(md);
- memcpy(WBUFP(buf,6), md->name, NAME_LENGTH);
- if( md->guardian_data && md->guardian_data->g )
- {
- WBUFW(buf, 0) = cmd = 0x195;
- WBUFB(buf,30) = 0;
- memcpy(WBUFP(buf,54), md->guardian_data->g->name, NAME_LENGTH);
- memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH);
- }
- else if( battle_config.show_mob_info )
- {
- char mobhp[50], *str_p = mobhp;
- WBUFW(buf, 0) = cmd = 0x195;
- if( battle_config.show_mob_info&4 )
- str_p += sprintf(str_p, "Lv. %d | ", md->level);
- if( battle_config.show_mob_info&1 )
- str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
- if( battle_config.show_mob_info&2 )
- str_p += sprintf(str_p, "HP: %u%% | ", get_percentage(md->status.hp, md->status.max_hp));
- //Even thought mobhp ain't a name, we send it as one so the client
- //can parse it. [Skotlex]
- if( str_p != mobhp )
- {
- *(str_p-3) = '\0'; //Remove trailing space + pipe.
- memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH);
- WBUFB(buf,54) = 0;
- WBUFB(buf,78) = 0;
- }
+ memcpy(WBUFP(buf,6), md->name, NAME_LENGTH);
+ if (md->guardian_data && md->guardian_data->g) {
+ WBUFW(buf, 0) = cmd = 0x195;
+ WBUFB(buf,30) = 0;
+ memcpy(WBUFP(buf,54), md->guardian_data->g->name, NAME_LENGTH);
+ memcpy(WBUFP(buf,78), md->guardian_data->castle->castle_name, NAME_LENGTH);
+ } else if (battle_config.show_mob_info) {
+ char mobhp[50], *str_p = mobhp;
+ WBUFW(buf, 0) = cmd = 0x195;
+ if (battle_config.show_mob_info&4)
+ str_p += sprintf(str_p, "Lv. %d | ", md->level);
+ if (battle_config.show_mob_info&1)
+ str_p += sprintf(str_p, "HP: %u/%u | ", md->status.hp, md->status.max_hp);
+ if (battle_config.show_mob_info&2)
+ str_p += sprintf(str_p, "HP: %u%% | ", get_percentage(md->status.hp, md->status.max_hp));
+ //Even thought mobhp ain't a name, we send it as one so the client
+ //can parse it. [Skotlex]
+ if (str_p != mobhp) {
+ *(str_p-3) = '\0'; //Remove trailing space + pipe.
+ memcpy(WBUFP(buf,30), mobhp, NAME_LENGTH);
+ WBUFB(buf,54) = 0;
+ WBUFB(buf,78) = 0;
}
}
+ }
break;
case BL_CHAT:
#if 0 //FIXME: Clients DO request this... what should be done about it? The chat's title may not fit... [Skotlex]
diff --git a/src/map/guild.c b/src/map/guild.c
index 0dd4c876b..ada731bf6 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1229,7 +1229,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
continue;
// update permanent guardians
for( i = 0; i < ARRAYLENGTH(gc->guardian); ++i ) {
- TBL_MOB* md = (gc->guardian[i].id ? map->id2md(gc->guardian[i].id) : NULL);
+ struct mob_data *md = gc->guardian[i].id ? map->id2md(gc->guardian[i].id) : NULL;
if( md == NULL || md->guardian_data == NULL )
continue;
@@ -1237,7 +1237,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
}
// update temporary guardians
for( i = 0; i < gc->temp_guardians_max; ++i ) {
- TBL_MOB* md = (gc->temp_guardians[i] ? map->id2md(gc->temp_guardians[i]) : NULL);
+ struct mob_data *md = gc->temp_guardians[i] ? map->id2md(gc->temp_guardians[i]) : NULL;
if( md == NULL || md->guardian_data == NULL )
continue;
diff --git a/src/map/map.c b/src/map/map.c
index dd6996af2..f5b8618cc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1743,10 +1743,8 @@ void map_addiddb(struct block_list *bl)
struct map_session_data *sd = (struct map_session_data *)bl;
idb_put(map->pc_db,sd->bl.id,sd);
idb_put(map->charid_db,sd->status.char_id,sd);
- }
- else if( bl->type == BL_MOB )
- {
- TBL_MOB* md = (TBL_MOB*)bl;
+ } else if (bl->type == BL_MOB) {
+ struct mob_data* md = (struct mob_data*)bl;
idb_put(map->mobid_db,bl->id,bl);
if( md->state.boss )
diff --git a/src/map/mob.c b/src/map/mob.c
index 76fc44c87..8b59cc413 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -684,7 +684,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if( has_index && gc->guardian[guardian].id ) {
//Check if guardian already exists, refuse to spawn if so.
- struct mob_data *md2 = (TBL_MOB*)map->id2bl(gc->guardian[guardian].id);
+ struct mob_data *md2 = (struct mob_data *)map->id2bl(gc->guardian[guardian].id);
if (md2 && md2->bl.type == BL_MOB
&& md2->guardian_data
&& md2->guardian_data->number == guardian
@@ -889,7 +889,7 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
int mobid[10] = { 0 }, i;
ARR_FIND(0, 10, i, (mobid[i] = va_arg(ap, int)) == 0); //fetch till 0
if (mobid[0]) { //if there one let's check it otherwise go backward
- TBL_MOB *md = BL_CAST(BL_MOB, bl);
+ struct mob_data *md = BL_CAST(BL_MOB, bl);
nullpo_ret(md);
ARR_FIND(0, 10, i, md->class_ == mobid[i]);
return (i < 10) ? 1 : 0;
@@ -1984,7 +1984,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
}
case BL_MOB:
{
- struct mob_data* md2 = (TBL_MOB*)src;
+ struct mob_data* md2 = (struct mob_data *)src;
if (md2->special_state.ai != AI_NONE && md2->master_id) {
struct map_session_data* msd = map->id2sd(md2->master_id);
if( msd )
diff --git a/src/map/party.c b/src/map/party.c
index a1f315c54..7d44a61c5 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -955,8 +955,8 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
for (i = 0; i < c; i++) {
#ifdef RENEWAL_EXP
- if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){
- struct mob_data *md = (TBL_MOB*)src;
+ if (!(src != NULL && src->type == BL_MOB && ((struct mob_data *)src)->db->mexp)) {
+ struct mob_data *md = (struct mob_data *)src;
int rate = pc->level_penalty_mod(md->level - (sd[i])->status.base_level, md->status.race, md->status.mode, 1);
base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX);
diff --git a/src/map/pc.c b/src/map/pc.c
index 880acd654..403619f96 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5259,7 +5259,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
if(!sd || !bl || bl->type!=BL_MOB)
return 0;
- md = (TBL_MOB *)bl;
+ md = (struct mob_data *)bl;
if(md->state.steal_flag == UCHAR_MAX || ( md->sc.opt1 && md->sc.opt1 != OPT1_BURNING && md->sc.opt1 != OPT1_CRYSTALIZE ) ) //already stolen from / status change check
return 0;
@@ -5337,7 +5337,7 @@ int pc_steal_coin(struct map_session_data *sd, struct block_list *target) {
if (!sd || !target || target->type != BL_MOB)
return 0;
- md = (TBL_MOB*)target;
+ md = (struct mob_data *)target;
if (md->state.steal_coin_flag || md->sc.data[SC_STONE] || md->sc.data[SC_FREEZE] || md->status.mode&MD_BOSS)
return 0;
diff --git a/src/map/script.c b/src/map/script.c
index 28ad217df..1cba7b029 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9874,8 +9874,9 @@ BUILDIN(areamonster) {
* KillMonster subcheck, verify if mob to kill ain't got an even to handle, could be force kill by allflag
*------------------------------------------*/
int buildin_killmonster_sub_strip(struct block_list *bl,va_list ap)
-{ //same fix but with killmonster instead - stripping events from mobs.
- TBL_MOB* md = (TBL_MOB*)bl;
+{
+ //same fix but with killmonster instead - stripping events from mobs.
+ struct mob_data *md = (struct mob_data *)bl;
char *event=va_arg(ap,char *);
int allflag=va_arg(ap,int);
@@ -9893,7 +9894,7 @@ int buildin_killmonster_sub_strip(struct block_list *bl,va_list ap)
}
int buildin_killmonster_sub(struct block_list *bl,va_list ap)
{
- TBL_MOB* md = (TBL_MOB*)bl;
+ struct mob_data *md = (struct mob_data *)bl;
char *event=va_arg(ap,char *);
int allflag=va_arg(ap,int);
@@ -16382,7 +16383,7 @@ BUILDIN(rid2name) {
int rid = script_getnum(st,2);
if((bl = map->id2bl(rid))) {
switch(bl->type) {
- case BL_MOB: script_pushstrcopy(st,((TBL_MOB*)bl)->name); break;
+ case BL_MOB: script_pushstrcopy(st, ((struct mob_data *)bl)->name); break;
case BL_PC: script_pushstrcopy(st, ((struct map_session_data *)bl)->status.name); break;
case BL_NPC: script_pushstrcopy(st,((TBL_NPC*)bl)->exname); break;
case BL_PET: script_pushstrcopy(st,((TBL_PET*)bl)->pet.name); break;
@@ -16607,7 +16608,7 @@ BUILDIN(unitattack) {
script_pushint(st, 1);
return true;
case BL_MOB:
- ((TBL_MOB *)unit_bl)->target_id = target_bl->id;
+ ((struct mob_data *)unit_bl)->target_id = target_bl->id;
break;
case BL_PET:
((TBL_PET *)unit_bl)->target_id = target_bl->id;
@@ -16636,7 +16637,7 @@ BUILDIN(unitstop) {
unit->stop_attack(bl);
unit->stop_walking(bl, STOPWALKING_FLAG_NEXTCELL);
if( bl->type == BL_MOB )
- ((TBL_MOB*)bl)->target_id = 0;
+ ((struct mob_data *)bl)->target_id = 0;
}
return true;
@@ -17565,7 +17566,7 @@ BUILDIN(bg_monster_set_team) {
if( (mbl = map->id2bl(id)) == NULL || mbl->type != BL_MOB )
return true;
- md = (TBL_MOB *)mbl;
+ md = (struct mob_data *)mbl;
md->bg_id = bg_id;
mob_stop_attack(md);
@@ -18125,7 +18126,7 @@ BUILDIN(setfont)
int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
{
- TBL_MOB* md = (TBL_MOB*)bl;
+ struct mob_data *md = (struct mob_data *)bl;
struct block_list *tbl;
int mobid = va_arg(ap,int);
uint16 skill_id = va_arg(ap,int);
diff --git a/src/map/skill.c b/src/map/skill.c
index 39f8ace34..341f94204 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -3032,7 +3032,7 @@ int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) {
if( skill_id == HP_BASILICA && bl->type == BL_PC )
return 0;
- if (skill_id == AM_DEMONSTRATION && bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPELIUM)
+ if (skill_id == AM_DEMONSTRATION && bl->type == BL_MOB && ((struct mob_data *)bl)->class_ == MOBID_EMPELIUM)
return 0; //Allow casting Bomb/Demonstration Right under emperium [Skotlex]
return 1;
}
@@ -5000,7 +5000,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) {
}
if (ud->skill_id >= SL_SKE && ud->skill_id <= SL_SKA && target->type == BL_MOB) {
- if (((TBL_MOB*)target)->class_ == MOBID_EMPELIUM)
+ if (((struct mob_data *)target)->class_ == MOBID_EMPELIUM)
break;
} else if (inf && battle->check_target(src, target, inf) <= 0) {
if (sd) clif->skill_fail(sd,ud->skill_id,USESKILL_FAIL_LEVEL,0);
@@ -5582,7 +5582,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (ud->target)
target_id = ud->target;
else switch (src->type) {
- case BL_MOB: target_id = ((TBL_MOB*)src)->target_id; break;
+ case BL_MOB: target_id = ((struct mob_data *)src)->target_id; break;
case BL_PET: target_id = ((TBL_PET*)src)->target_id; break;
}
if (!target_id)
@@ -9003,7 +9003,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if( is_boss(bl) ) break;
if( sc_start2(src,bl, type, 100, skill_lv, src->id, skill->get_time(skill_id, skill_lv))) {
if( bl->type == BL_MOB )
- mob->unlocktarget((TBL_MOB*)bl,timer->gettick());
+ mob->unlocktarget((struct mob_data *)bl, timer->gettick());
unit->stop_attack(bl);
clif->bladestop(src, bl->id, 1);
map->freeblock_unlock();
@@ -9270,7 +9270,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (ud->target)
target_id = ud->target;
else switch (src->type) {
- case BL_MOB: target_id = ((TBL_MOB*)src)->target_id; break;
+ case BL_MOB: target_id = ((struct mob_data *)src)->target_id; break;
case BL_PET: target_id = ((TBL_PET*)src)->target_id; break;
}
if (!target_id)
@@ -10648,9 +10648,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
} else {
int mob_id = skill_lv < 2 ? MOBID_BLACK_MUSHROOM + rnd()%2 : MOBID_RED_PLANT + rnd()%6;
- TBL_MOB* md = mob->once_spawn_sub(src, src->m, x, y, "--ja--", mob_id, "", SZ_SMALL, AI_NONE);
+ struct mob_data *md = mob->once_spawn_sub(src, src->m, x, y, "--ja--", mob_id, "", SZ_SMALL, AI_NONE);
int i;
- if (!md) break;
+ if (md == NULL)
+ break;
if ((i = skill->get_time(skill_id, skill_lv)) > 0)
{
if( md->deletetimer != INVALID_TIMER )
@@ -12559,7 +12560,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6
}
if (bl->type == BL_MOB && ss != bl)
- mob->skill_event((TBL_MOB*)bl, ss, tick, MSC_SKILLUSED|(skill_id<<16));
+ mob->skill_event((struct mob_data *)bl, ss, tick, MSC_SKILLUSED|(skill_id<<16));
return skill_id;
}
diff --git a/src/map/status.c b/src/map/status.c
index 4bbeed290..da318b14f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1417,7 +1417,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
switch (target->type) {
case BL_PC: pc->damage((struct map_session_data *)target, src, hp, sp); break;
- case BL_MOB: mob->damage((TBL_MOB*)target, src, hp); break;
+ case BL_MOB: mob->damage((struct mob_data *)target, src, hp); break;
case BL_HOM: homun->damaged((TBL_HOM*)target); break;
case BL_MER: mercenary->heal((TBL_MER*)target,hp,sp); break;
case BL_ELEM: elemental->heal((TBL_ELEM*)target,hp,sp); break;
@@ -1443,7 +1443,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
//&4: Also delete object from memory.
switch (target->type) {
case BL_PC: flag = pc->dead((struct map_session_data *)target, src); break;
- case BL_MOB: flag = mob->dead((TBL_MOB*)target, src, (flag&4) ? 3 : 0); break;
+ case BL_MOB: flag = mob->dead((struct mob_data *)target, src, (flag&4) ? 3 : 0); break;
case BL_HOM: flag = homun->dead((TBL_HOM*)target); break;
case BL_MER: flag = mercenary->dead((TBL_MER*)target); break;
case BL_ELEM: flag = elemental->dead((TBL_ELEM*)target); break;
@@ -1486,16 +1486,16 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp,
sc_start(target,target,status->skill2sc(PR_KYRIE),100,10,time);
if( target->type == BL_MOB )
- ((TBL_MOB*)target)->state.rebirth = 1;
+ ((struct mob_data *)target)->state.rebirth = 1;
return (int)(hp+sp);
}
- if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((TBL_MOB*) target)->state.rebirth) {
+ if (target->type == BL_MOB && sc && sc->data[SC_REBIRTH] && !((struct mob_data *) target)->state.rebirth) {
// Ensure the monster has not already rebirthed before doing so.
status->revive(target, sc->data[SC_REBIRTH]->val2, 0);
status->change_clear(target,0);
- ((TBL_MOB*)target)->state.rebirth = 1;
+ ((struct mob_data *)target)->state.rebirth = 1;
return (int)(hp+sp);
}
@@ -1583,7 +1583,7 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) {
// send hp update to client
switch(bl->type) {
case BL_PC: pc->heal((struct map_session_data *)bl,hp,sp,(flag&2) ? 1 : 0); break;
- case BL_MOB: mob->heal((TBL_MOB*)bl,hp); break;
+ case BL_MOB: mob->heal((struct mob_data *)bl,hp); break;
case BL_HOM: homun->healed((TBL_HOM*)bl); break;
case BL_MER: mercenary->heal((TBL_MER*)bl,hp,sp); break;
case BL_ELEM: elemental->heal((TBL_ELEM*)bl,hp,sp); break;
@@ -1680,7 +1680,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
switch (bl->type) {
case BL_PC: pc->revive((struct map_session_data *)bl, hp, sp); break;
- case BL_MOB: mob->revive((TBL_MOB*)bl, hp); break;
+ case BL_MOB: mob->revive((struct mob_data *)bl, hp); break;
case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
}
return 1;
@@ -1715,7 +1715,7 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int
clif->resurrection(bl, 1);
switch (bl->type) {
case BL_PC: pc->revive((struct map_session_data *)bl, hp, sp); break;
- case BL_MOB: mob->revive((TBL_MOB*)bl, hp); break;
+ case BL_MOB: mob->revive((struct mob_data *)bl, hp); break;
case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
}
return 1;
@@ -2084,7 +2084,7 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) {
//Max HP setting from Summon Flora/marine Sphere
struct unit_data *ud = unit->bl2ud(mbl);
//Remove special AI when this is used by regular mobs.
- if (mbl->type == BL_MOB && ((TBL_MOB*)mbl)->special_state.ai == AI_NONE)
+ if (mbl->type == BL_MOB && ((struct mob_data *)mbl)->special_state.ai == AI_NONE)
md->special_state.ai = AI_NONE;
if (ud) {
// different levels of HP according to skill level
@@ -4120,7 +4120,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target) {
switch ( src->type ) {
case BL_MOB:
- view_range = ((TBL_MOB*)src)->min_chase;
+ view_range = ((struct mob_data *)src)->min_chase;
break;
case BL_PET:
view_range = ((TBL_PET*)src)->db->range2;
@@ -4253,7 +4253,7 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
#ifdef RENEWAL
str = (int)(dstr + (float)dex / 5 + (float)st->luk / 3 + (float)((struct map_session_data *)bl)->status.base_level / 4);
else if ( bl->type == BL_MOB || bl->type == BL_MER )
- str = dstr + ((TBL_MOB*)bl)->level;
+ str = dstr + ((struct mob_data *)bl)->level;
#else
str += dex / 5 + st->luk / 5;
#endif
@@ -5978,7 +5978,7 @@ short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int
unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *sc, int dmotion) {
// It has been confirmed on official servers that MvP mobs have no dmotion even without endure
- if( bl->type == BL_MOB && (((TBL_MOB*)bl)->status.mode&MD_BOSS) )
+ if (bl->type == BL_MOB && (((struct mob_data *)bl)->status.mode&MD_BOSS))
return 0;
if( !sc || !sc->count || map_flag_gvg2(bl->m) || map->list[bl->m].flag.battleground )
@@ -6206,7 +6206,7 @@ const char* status_get_name(struct block_list *bl) {
nullpo_ret(bl);
switch (bl->type) {
case BL_PC: return ((struct map_session_data *)bl)->fakename[0] != '\0' ? ((struct map_session_data *)bl)->fakename : ((struct map_session_data *)bl)->status.name;
- case BL_MOB: return ((TBL_MOB*)bl)->name;
+ case BL_MOB: return ((struct mob_data *)bl)->name;
case BL_PET: return ((TBL_PET*)bl)->pet.name;
case BL_HOM: return ((TBL_HOM*)bl)->homunculus.name;
case BL_NPC: return ((TBL_NPC*)bl)->name;
@@ -6224,7 +6224,7 @@ int status_get_class(struct block_list *bl) {
nullpo_ret(bl);
switch( bl->type ) {
case BL_PC: return ((struct map_session_data *)bl)->status.class_;
- case BL_MOB: return ((TBL_MOB*)bl)->vd->class_; //Class used on all code should be the view class of the mob.
+ case BL_MOB: return ((struct mob_data *)bl)->vd->class_; //Class used on all code should be the view class of the mob.
case BL_PET: return ((TBL_PET*)bl)->pet.class_;
case BL_HOM: return ((TBL_HOM*)bl)->homunculus.class_;
case BL_MER: return ((TBL_MER*)bl)->mercenary.class_;
@@ -6243,7 +6243,7 @@ int status_get_lv(struct block_list *bl) {
nullpo_ret(bl);
switch (bl->type) {
case BL_PC: return ((struct map_session_data *)bl)->status.base_level;
- case BL_MOB: return ((TBL_MOB*)bl)->level;
+ case BL_MOB: return ((struct mob_data *)bl)->level;
case BL_PET: return ((TBL_PET*)bl)->pet.level;
case BL_HOM: return ((TBL_HOM*)bl)->homunculus.level;
case BL_MER: return ((TBL_MER*)bl)->db->lv;
@@ -6272,7 +6272,7 @@ struct status_data *status_get_status_data(struct block_list *bl)
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->battle_status;
- case BL_MOB: return &((TBL_MOB*)bl)->status;
+ case BL_MOB: return &((struct mob_data *)bl)->status;
case BL_PET: return &((TBL_PET*)bl)->status;
case BL_HOM: return &((TBL_HOM*)bl)->battle_status;
case BL_MER: return &((TBL_MER*)bl)->battle_status;
@@ -6288,7 +6288,7 @@ struct status_data *status_get_base_status(struct block_list *bl)
nullpo_retr(NULL, bl);
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->base_status;
- case BL_MOB: return ((TBL_MOB*)bl)->base_status ? ((TBL_MOB*)bl)->base_status : &((TBL_MOB*)bl)->db->status;
+ case BL_MOB: return ((struct mob_data *)bl)->base_status ? ((struct mob_data *)bl)->base_status : &((struct mob_data *)bl)->db->status;
case BL_PET: return &((TBL_PET*)bl)->db->status;
case BL_HOM: return &((TBL_HOM*)bl)->base_status;
case BL_MER: return &((TBL_MER*)bl)->base_status;
@@ -6324,16 +6324,17 @@ int status_get_party_id(struct block_list *bl) {
if (((TBL_PET*)bl)->msd)
return ((TBL_PET*)bl)->msd->status.party_id;
break;
- case BL_MOB: {
- struct mob_data *md=(TBL_MOB*)bl;
- if( md->master_id > 0 ) {
+ case BL_MOB:
+ {
+ struct mob_data *md = (struct mob_data *)bl;
+ if (md->master_id > 0) {
struct map_session_data *msd;
if (md->special_state.ai != AI_NONE && (msd = map->id2sd(md->master_id)) != NULL)
return msd->status.party_id;
return -md->master_id;
}
- }
- break;
+ }
+ break;
case BL_HOM:
if (((TBL_HOM*)bl)->master)
return ((TBL_HOM*)bl)->master->status.party_id;
@@ -6408,15 +6409,16 @@ int status_get_emblem_id(struct block_list *bl) {
if (((TBL_PET*)bl)->msd)
return ((TBL_PET*)bl)->msd->guild_emblem_id;
break;
- case BL_MOB: {
+ case BL_MOB:
+ {
struct map_session_data *msd;
struct mob_data *md = (struct mob_data *)bl;
if (md->guardian_data) //Guardian's guild [Skotlex]
return (md->guardian_data->g) ? md->guardian_data->g->emblem_id:0;
if (md->special_state.ai != AI_NONE && (msd = map->id2sd(md->master_id)) != NULL)
return msd->guild_emblem_id; //Alchemist's mobs [Skotlex]
- }
- break;
+ }
+ break;
case BL_HOM:
if (((TBL_HOM*)bl)->master)
return ((TBL_HOM*)bl)->master->guild_emblem_id;
@@ -6479,7 +6481,7 @@ struct view_data* status_get_viewdata(struct block_list *bl)
nullpo_retr(NULL, bl);
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->vd;
- case BL_MOB: return ((TBL_MOB*)bl)->vd;
+ case BL_MOB: return ((struct mob_data *)bl)->vd;
case BL_PET: return &((TBL_PET*)bl)->vd;
case BL_NPC: return ((TBL_NPC*)bl)->vd;
case BL_HOM: return ((TBL_HOM*)bl)->vd;
@@ -6573,13 +6575,13 @@ void status_set_viewdata(struct block_list *bl, int class_)
}
break;
case BL_MOB:
- {
- TBL_MOB* md = (TBL_MOB*)bl;
- if (vd)
- md->vd = vd;
- else
- ShowError("status_set_viewdata (MOB): No view data for class %d\n", class_);
- }
+ {
+ struct mob_data *md = (struct mob_data *)bl;
+ if (vd != NULL)
+ md->vd = vd;
+ else
+ ShowError("status_set_viewdata (MOB): No view data for class %d\n", class_);
+ }
break;
case BL_PET:
{
@@ -6642,7 +6644,7 @@ struct status_change *status_get_sc(struct block_list *bl) {
if( bl ) {
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->sc;
- case BL_MOB: return &((TBL_MOB*)bl)->sc;
+ case BL_MOB: return &((struct mob_data *)bl)->sc;
case BL_NPC: return NULL;
case BL_HOM: return &((TBL_HOM*)bl)->sc;
case BL_MER: return &((TBL_MER*)bl)->sc;
@@ -8158,7 +8160,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
if( val2 && bl->type == BL_MOB ) {
struct block_list* src2 = map->id2bl(val2);
if( src2 )
- mob->log_damage((TBL_MOB*)bl,src2,diff);
+ mob->log_damage((struct mob_data *)bl, src2, diff);
}
status_zap(bl, diff, 0);
}
@@ -8232,7 +8234,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
//val4&1 signals the presence of a wall.
//val4&2 makes cloak not end on normal attacks [Skotlex]
//val4&4 makes cloak not end on using skills
- if (bl->type == BL_PC || (bl->type == BL_MOB && ((TBL_MOB*)bl)->special_state.clone) ) //Standard cloaking.
+ if (bl->type == BL_PC || (bl->type == BL_MOB && ((struct mob_data *)bl)->special_state.clone)) //Standard cloaking.
val4 |= battle_config.pc_cloak_check_type&7;
else
val4 |= battle_config.monster_cloak_check_type&7;
@@ -8453,7 +8455,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t
if( val3 && bl->type == BL_MOB ) {
struct block_list* src2 = map->id2bl(val3);
if( src2 )
- mob->log_damage((TBL_MOB*)bl,src2,st->hp - 1);
+ mob->log_damage((struct mob_data *)bl,src2,st->hp - 1);
}
status_zap(bl, st->hp-1, val2 ? 0 : st->sp);
return 1;
@@ -10996,8 +10998,8 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
if (!sc->data[SC_SLOWPOISON]) {
if( sce->val2 && bl->type == BL_MOB ) {
struct block_list* src = map->id2bl(sce->val2);
- if( src )
- mob->log_damage((TBL_MOB*)bl,src,sce->val4);
+ if (src != NULL)
+ mob->log_damage((struct mob_data *)bl,src,sce->val4);
}
map->freeblock_lock();
status_zap(bl, sce->val4, 0);
@@ -11036,7 +11038,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) {
int hp = rnd()%600 + 200;
struct block_list* src = map->id2bl(sce->val2);
if( src && bl && bl->type == BL_MOB ) {
- mob->log_damage((TBL_MOB*)bl,src,sd||hp<st->hp?hp:st->hp-1);
+ mob->log_damage((struct mob_data *)bl, src, sd != NULL || hp < st->hp ? hp : st->hp-1);
}
map->freeblock_lock();
status_fix_damage(src, bl, sd||hp<st->hp?hp:st->hp-1, 1);
@@ -11924,8 +11926,8 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m
*matk_max += 130 * ((TBL_MER*)bl)->battle_status.rhw.atk2 / 100;
break;
case BL_MOB:
- *matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
- *matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
+ *matk_min += 70 * ((struct mob_data *)bl)->status.rhw.atk2 / 100;
+ *matk_max += 130 * ((struct mob_data *)bl)->status.rhw.atk2 / 100;
break;
case BL_HOM:
*matk_min += (status_get_homint(bl) + status_get_homdex(bl)) / 5;
diff --git a/src/map/unit.c b/src/map/unit.c
index a9933d8b9..9fb1c24fd 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -448,7 +448,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) {
//Cancel chase.
ud->to_x = bl->x;
ud->to_y = bl->y;
- if (tbl && bl->type == BL_MOB && mob->warpchase((TBL_MOB*)bl, tbl) )
+ if (tbl && bl->type == BL_MOB && mob->warpchase((struct mob_data *)bl, tbl))
return 0;
ud->target_to = 0;
return 0;
@@ -917,9 +917,9 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
switch (bl->type) {
case BL_MOB:
- if (map->list[bl->m].flag.monster_noteleport && ((TBL_MOB*)bl)->master_id == 0)
+ if (map->list[bl->m].flag.monster_noteleport && ((struct mob_data *)bl)->master_id == 0)
return 1;
- if (m != bl->m && map->list[m].flag.nobranch && battle_config.mob_warp&4 && !(((TBL_MOB *)bl)->master_id))
+ if (m != bl->m && map->list[m].flag.nobranch && battle_config.mob_warp&4 && ((struct mob_data *)bl)->master_id == 0)
return 1;
break;
case BL_PC:
@@ -1164,7 +1164,7 @@ int unit_set_walkdelay(struct block_list *bl, int64 tick, int delay, int type) {
if (type) {
//Bosses can ignore skill induced walkdelay (but not damage induced)
- if(bl->type == BL_MOB && (((TBL_MOB*)bl)->status.mode&MD_BOSS))
+ if (bl->type == BL_MOB && (((struct mob_data *)bl)->status.mode&MD_BOSS))
return 0;
//Make sure walk delay is not decreased
if (DIFF_TICK(ud->canmove_tick, tick+delay) > 0)
@@ -1386,7 +1386,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
case NPC_SUMMONSLAVE:
case NPC_SUMMONMONSTER:
case AL_TELEPORT:
- if (((TBL_MOB*)src)->master_id && ((TBL_MOB*)src)->special_state.ai != AI_NONE)
+ if (((struct mob_data *)src)->master_id && ((struct mob_data *)src)->special_state.ai != AI_NONE)
return 0;
}
@@ -1566,7 +1566,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
{
if (sd && target->type == BL_MOB)
{
- TBL_MOB *md = (TBL_MOB*)target;
+ struct mob_data *md = (struct mob_data *)target;
mob->skill_event(md, src, tick, -1); //Cast targeted skill event.
if (tstatus->mode&(MD_CASTSENSOR_IDLE|MD_CASTSENSOR_CHASE) &&
battle->check_target(target, src, BCT_ENEMY) > 0)
@@ -2088,7 +2088,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
if( src->m != target->m )
{
- if( src->type == BL_MOB && mob->warpchase((TBL_MOB*)src, target) )
+ if (src->type == BL_MOB && mob->warpchase((struct mob_data *)src, target))
return 1; // Follow up.
return 0;
}
@@ -2256,7 +2256,8 @@ int unit_skillcastcancel(struct block_list *bl,int type)
}
}
- if(bl->type==BL_MOB) ((TBL_MOB*)bl)->skill_idx = -1;
+ if (bl->type == BL_MOB)
+ ((struct mob_data *)bl)->skill_idx = -1;
clif->skillcastcancel(bl);
return 1;
@@ -2313,7 +2314,7 @@ int unit_changeviewsize(struct block_list *bl,short size)
if(bl->type == BL_PC) {
((struct map_session_data *)bl)->state.size = size;
} else if(bl->type == BL_MOB) {
- ((TBL_MOB*)bl)->special_state.size=size;
+ ((struct mob_data *)bl)->special_state.size = size;
} else
return 0;
if(size!=0)