summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2015-12-26 11:17:14 +0200
committerHaru <haru@dotalux.com>2016-01-06 15:09:55 +0100
commit829ebdd1527a7a4a585056463f8871d926698e2d (patch)
treedb7a21cf1f33a05896793f9500580b969ca914ba
parentb040c619b505fd7423576f88bb0fe7de35848d3d (diff)
downloadhercules-829ebdd1527a7a4a585056463f8871d926698e2d.tar.gz
hercules-829ebdd1527a7a4a585056463f8871d926698e2d.tar.bz2
hercules-829ebdd1527a7a4a585056463f8871d926698e2d.tar.xz
hercules-829ebdd1527a7a4a585056463f8871d926698e2d.zip
Change all TBL_PET to struct pet_data as per style guidelines
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/battle.c4
-rw-r--r--src/map/battleground.c4
-rw-r--r--src/map/clif.c8
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/script.c6
-rw-r--r--src/map/skill.c18
-rw-r--r--src/map/status.c53
-rw-r--r--src/map/unit.c2
9 files changed, 52 insertions, 49 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 54769374a..59369f6a9 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6389,8 +6389,8 @@ struct block_list* battle_get_master(struct block_list *src) {
prev = src;
switch (src->type) {
case BL_PET:
- if (((TBL_PET*)src)->msd)
- src = (struct block_list*)((TBL_PET*)src)->msd;
+ if (((struct pet_data *)src)->msd != NULL)
+ src = (struct block_list *)((struct pet_data *)src)->msd;
break;
case BL_MOB:
if (((struct mob_data *)src)->master_id != 0)
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 72ccbeb78..5d88180d5 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -222,8 +222,8 @@ int bg_team_get_id(struct block_list *bl) {
case BL_PC:
return ((struct map_session_data *)bl)->bg_id;
case BL_PET:
- if( ((TBL_PET*)bl)->msd )
- return ((TBL_PET*)bl)->msd->bg_id;
+ if (((struct pet_data *)bl)->msd != NULL)
+ return ((struct pet_data *)bl)->msd->bg_id;
break;
case BL_MOB:
{
diff --git a/src/map/clif.c b/src/map/clif.c
index a4ff28bb6..1ca323136 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1463,7 +1463,7 @@ bool clif_spawn(struct block_list *bl)
break;
case BL_PET:
if (vd->head_bottom)
- clif->send_petdata(NULL, (TBL_PET*)bl, 3, vd->head_bottom); // needed to display pet equip properly
+ clif->send_petdata(NULL, (struct pet_data *)bl, 3, vd->head_bottom); // needed to display pet equip properly
break;
}
return true;
@@ -1709,7 +1709,7 @@ void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_data *u
break;
case BL_PET:
if( vd->head_bottom ) // needed to display pet equip properly
- clif->send_petdata(NULL, (TBL_PET*)bl, 3, vd->head_bottom);
+ clif->send_petdata(NULL, (struct pet_data *)bl, 3, vd->head_bottom);
break;
}
#ifdef ANTI_MAYAP_CHEAT
@@ -4233,7 +4233,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
break;
case BL_PET:
if (vd->head_bottom)
- clif->send_petdata(NULL, (TBL_PET*)bl, 3, vd->head_bottom); // needed to display pet equip properly
+ clif->send_petdata(NULL, (struct pet_data *)bl, 3, vd->head_bottom); // needed to display pet equip properly
break;
}
}
@@ -8415,7 +8415,7 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), ((struct mercenary_data *)bl)->db->name, NAME_LENGTH);
break;
case BL_PET:
- memcpy(WBUFP(buf,6), ((TBL_PET*)bl)->pet.name, NAME_LENGTH);
+ memcpy(WBUFP(buf,6), ((struct pet_data *)bl)->pet.name, NAME_LENGTH);
break;
case BL_NPC:
memcpy(WBUFP(buf,6), ((TBL_NPC*)bl)->name, NAME_LENGTH);
diff --git a/src/map/mob.c b/src/map/mob.c
index 311e1049d..f74f4e85f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1972,7 +1972,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
}
case BL_PET:
{
- struct pet_data *pd = (TBL_PET*)src;
+ struct pet_data *pd = (struct pet_data *)src;
flag = MDLF_PET;
if( pd->msd )
{
@@ -2582,7 +2582,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
md->status.hp = 0; //So that npc_event invoked functions KNOW that mob is dead
if( src ) {
switch( src->type ) {
- case BL_PET: sd = ((TBL_PET*)src)->msd; break;
+ case BL_PET: sd = ((struct pet_data *)src)->msd; break;
case BL_HOM: sd = ((struct homun_data *)src)->master; break;
case BL_MER: sd = ((struct mercenary_data *)src)->master; break;
case BL_ELEM: sd = ((TBL_ELEM*)src)->master; break;
diff --git a/src/map/pc.c b/src/map/pc.c
index 8c794922b..3c93be7df 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7623,7 +7623,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) {
}
break;
case BL_PET: //Pass on to master...
- src = &((TBL_PET*)src)->msd->bl;
+ src = &((struct pet_data *)src)->msd->bl;
break;
case BL_HOM:
src = &((struct homun_data *)src)->master->bl;
diff --git a/src/map/script.c b/src/map/script.c
index 51f18dfb6..66db534d7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13623,7 +13623,7 @@ BUILDIN(recovery)
BUILDIN(getpetinfo)
{
struct map_session_data *sd = script->rid2sd(st);
- TBL_PET *pd;
+ struct pet_data *pd;
int type=script_getnum(st,2);
if (sd == NULL || sd->pd == NULL) {
@@ -16386,7 +16386,7 @@ BUILDIN(rid2name) {
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, ((struct npc_data *)bl)->exname); break;
- case BL_PET: script_pushstrcopy(st,((TBL_PET*)bl)->pet.name); break;
+ case BL_PET: script_pushstrcopy(st, ((struct pet_data *)bl)->pet.name); break;
case BL_HOM: script_pushstrcopy(st, ((struct homun_data *)bl)->homunculus.name); break;
case BL_MER: script_pushstrcopy(st, ((struct mercenary_data *)bl)->db->name); break;
default:
@@ -16611,7 +16611,7 @@ BUILDIN(unitattack) {
((struct mob_data *)unit_bl)->target_id = target_bl->id;
break;
case BL_PET:
- ((TBL_PET *)unit_bl)->target_id = target_bl->id;
+ ((struct pet_data *)unit_bl)->target_id = target_bl->id;
break;
default:
ShowError("script:unitattack: unsupported source unit type %d\n", unit_bl->type);
diff --git a/src/map/skill.c b/src/map/skill.c
index dd69092e8..9f7ecc049 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2231,8 +2231,8 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
dmg = battle->calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF);
//Skotlex: Adjusted to the new system
- if( src->type == BL_PET ) { // [Valaris]
- struct pet_data *pd = (TBL_PET*)src;
+ if (src->type == BL_PET) { // [Valaris]
+ struct pet_data *pd = (struct pet_data *)src;
if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id) {
int element = skill->get_ele(skill_id, skill_lv);
/*if (skill_id == -1) Does it ever worked?
@@ -5574,8 +5574,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (!ud) break;
if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) {
if (src->type == BL_PET)
- bl = (struct block_list*)((TBL_PET*)src)->msd;
- if (!bl) bl = src;
+ bl = (struct block_list *)((struct pet_data *)src)->msd;
+ if (bl == NULL)
+ bl = src;
unit->skilluse_id(src, bl->id, abra_skill_id, abra_skill_lv);
} else { //Assume offensive skills
int target_id = 0;
@@ -5583,7 +5584,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
target_id = ud->target;
else switch (src->type) {
case BL_MOB: target_id = ((struct mob_data *)src)->target_id; break;
- case BL_PET: target_id = ((TBL_PET*)src)->target_id; break;
+ case BL_PET: target_id = ((struct pet_data *)src)->target_id; break;
}
if (!target_id)
break;
@@ -9262,8 +9263,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if (!ud) break;
if (inf&INF_SELF_SKILL || inf&INF_SUPPORT_SKILL) {
if (src->type == BL_PET)
- bl = (struct block_list*)((TBL_PET*)src)->msd;
- if (!bl) bl = src;
+ bl = (struct block_list *)((struct pet_data *)src)->msd;
+ if (bl == NULL)
+ bl = src;
unit->skilluse_id(src, bl->id, improv_skill_id, improv_skill_lv);
} else {
int target_id = 0;
@@ -9271,7 +9273,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
target_id = ud->target;
else switch (src->type) {
case BL_MOB: target_id = ((struct mob_data *)src)->target_id; break;
- case BL_PET: target_id = ((TBL_PET*)src)->target_id; break;
+ case BL_PET: target_id = ((struct pet_data *)src)->target_id; break;
}
if (!target_id)
break;
diff --git a/src/map/status.c b/src/map/status.c
index ba99cb562..c98231712 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4123,7 +4123,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target) {
view_range = ((struct mob_data *)src)->min_chase;
break;
case BL_PET:
- view_range = ((TBL_PET*)src)->db->range2;
+ view_range = ((struct pet_data *)src)->db->range2;
break;
default:
view_range = AREA_SIZE;
@@ -6207,7 +6207,7 @@ const char* status_get_name(struct block_list *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 ((struct mob_data *)bl)->name;
- case BL_PET: return ((TBL_PET*)bl)->pet.name;
+ case BL_PET: return ((struct pet_data *)bl)->pet.name;
case BL_HOM: return ((struct homun_data *)bl)->homunculus.name;
case BL_NPC: return ((TBL_NPC*)bl)->name;
}
@@ -6225,7 +6225,7 @@ int status_get_class(struct block_list *bl) {
switch( bl->type ) {
case BL_PC: return ((struct map_session_data *)bl)->status.class_;
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_PET: return ((struct pet_data *)bl)->pet.class_;
case BL_HOM: return ((struct homun_data *)bl)->homunculus.class_;
case BL_MER: return ((struct mercenary_data *)bl)->mercenary.class_;
case BL_NPC: return ((TBL_NPC*)bl)->class_;
@@ -6244,7 +6244,7 @@ int status_get_lv(struct block_list *bl) {
switch (bl->type) {
case BL_PC: return ((struct map_session_data *)bl)->status.base_level;
case BL_MOB: return ((struct mob_data *)bl)->level;
- case BL_PET: return ((TBL_PET*)bl)->pet.level;
+ case BL_PET: return ((struct pet_data *)bl)->pet.level;
case BL_HOM: return ((struct homun_data *)bl)->homunculus.level;
case BL_MER: return ((struct mercenary_data *)bl)->db->lv;
case BL_ELEM: return ((TBL_ELEM*)bl)->db->lv;
@@ -6273,7 +6273,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 &((struct mob_data *)bl)->status;
- case BL_PET: return &((TBL_PET*)bl)->status;
+ case BL_PET: return &((struct pet_data *)bl)->status;
case BL_HOM: return &((struct homun_data *)bl)->battle_status;
case BL_MER: return &((struct mercenary_data *)bl)->battle_status;
case BL_ELEM: return &((TBL_ELEM*)bl)->battle_status;
@@ -6289,7 +6289,7 @@ struct status_data *status_get_base_status(struct block_list *bl)
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->base_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_PET: return &((struct pet_data *)bl)->db->status;
case BL_HOM: return &((struct homun_data *)bl)->base_status;
case BL_MER: return &((struct mercenary_data *)bl)->base_status;
case BL_ELEM: return &((TBL_ELEM*)bl)->base_status;
@@ -6321,8 +6321,8 @@ int status_get_party_id(struct block_list *bl) {
case BL_PC:
return ((struct map_session_data *)bl)->status.party_id;
case BL_PET:
- if (((TBL_PET*)bl)->msd)
- return ((TBL_PET*)bl)->msd->status.party_id;
+ if (((struct pet_data *)bl)->msd != NULL)
+ return ((struct pet_data *)bl)->msd->status.party_id;
break;
case BL_MOB:
{
@@ -6361,8 +6361,8 @@ int status_get_guild_id(struct block_list *bl) {
case BL_PC:
return ((struct map_session_data *)bl)->status.guild_id;
case BL_PET:
- if (((TBL_PET*)bl)->msd)
- return ((TBL_PET*)bl)->msd->status.guild_id;
+ if (((struct pet_data *)bl)->msd != NULL)
+ return ((struct pet_data *)bl)->msd->status.guild_id;
break;
case BL_MOB:
{
@@ -6406,8 +6406,8 @@ int status_get_emblem_id(struct block_list *bl) {
case BL_PC:
return ((struct map_session_data *)bl)->guild_emblem_id;
case BL_PET:
- if (((TBL_PET*)bl)->msd)
- return ((TBL_PET*)bl)->msd->guild_emblem_id;
+ if (((struct pet_data *)bl)->msd != NULL)
+ return ((struct pet_data *)bl)->msd->guild_emblem_id;
break;
case BL_MOB:
{
@@ -6482,7 +6482,7 @@ struct view_data* status_get_viewdata(struct block_list *bl)
switch (bl->type) {
case BL_PC: return &((struct map_session_data *)bl)->vd;
case BL_MOB: return ((struct mob_data *)bl)->vd;
- case BL_PET: return &((TBL_PET*)bl)->vd;
+ case BL_PET: return &((struct pet_data *)bl)->vd;
case BL_NPC: return ((TBL_NPC*)bl)->vd;
case BL_HOM: return ((struct homun_data *)bl)->vd;
case BL_MER: return ((struct mercenary_data *)bl)->vd;
@@ -6584,21 +6584,22 @@ void status_set_viewdata(struct block_list *bl, int class_)
}
break;
case BL_PET:
- {
- TBL_PET* pd = (TBL_PET*)bl;
- if (vd) {
- memcpy(&pd->vd, vd, sizeof(struct view_data));
- if (!pc->db_checkid(vd->class_)) {
- pd->vd.hair_style = battle_config.pet_hair_style;
- if(pd->pet.equip) {
- pd->vd.head_bottom = itemdb_viewid(pd->pet.equip);
- if (!pd->vd.head_bottom)
- pd->vd.head_bottom = pd->pet.equip;
- }
+ {
+ struct pet_data *pd = (struct pet_data *)bl;
+ if (vd != NULL) {
+ memcpy(&pd->vd, vd, sizeof(struct view_data));
+ if (!pc->db_checkid(vd->class_)) {
+ pd->vd.hair_style = battle_config.pet_hair_style;
+ if(pd->pet.equip) {
+ pd->vd.head_bottom = itemdb_viewid(pd->pet.equip);
+ if (!pd->vd.head_bottom)
+ pd->vd.head_bottom = pd->pet.equip;
}
- } else
- ShowError("status_set_viewdata (PET): No view data for class %d\n", class_);
+ }
+ } else {
+ ShowError("status_set_viewdata (PET): No view data for class %d\n", class_);
}
+ }
break;
case BL_NPC:
{
diff --git a/src/map/unit.c b/src/map/unit.c
index 5d6c3b77a..fab001adb 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2161,7 +2161,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) {
map->foreachinrange(mob->linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick);
}
}
- if(src->type == BL_PET && pet->attackskill((TBL_PET*)src, target->id))
+ if (src->type == BL_PET && pet->attackskill((struct pet_data *)src, target->id))
return 1;
map->freeblock_lock();