diff options
author | hemagx <hemagx2@gmail.com> | 2015-12-26 11:17:14 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-01-06 15:09:54 +0100 |
commit | 3364658237805c34ebc074d52d34f540c8a8ee56 (patch) | |
tree | 1bae2bca09c3f8b08d5a41be55efbe3cb2fa3d1a | |
parent | 1249dc22081a0be982489aae8f18e1658e0cba95 (diff) | |
download | hercules-3364658237805c34ebc074d52d34f540c8a8ee56.tar.gz hercules-3364658237805c34ebc074d52d34f540c8a8ee56.tar.bz2 hercules-3364658237805c34ebc074d52d34f540c8a8ee56.tar.xz hercules-3364658237805c34ebc074d52d34f540c8a8ee56.zip |
Change all TBL_HOM to struct homun_data as per style guidelines
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/battle.c | 15 | ||||
-rw-r--r-- | src/map/battleground.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 10 | ||||
-rw-r--r-- | src/map/status.c | 68 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
10 files changed, 57 insertions, 56 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 59c889f55..c5edd9934 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6800,7 +6800,7 @@ ACMD(showmobs) * homunculus level up [orn] *------------------------------------------*/ ACMD(homlevel) { - TBL_HOM * hd; + struct homun_data *hd; int level = 0; enum homun_type htype; diff --git a/src/map/battle.c b/src/map/battle.c index ded0ecac9..af2ef018a 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3202,7 +3202,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam clif->millenniumshield(bl, sc->fv_counter++); if (sc->data[SC_STYLE_CHANGE] && rnd()%2) { - TBL_HOM *hd = BL_CAST(BL_HOM,bl); + struct homun_data *hd = BL_CAST(BL_HOM,bl); if (hd) homun->addspiritball(hd, 10); //add a sphere } @@ -3254,7 +3254,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if (tsc->data[SC_SHIELDSPELL_REF] && tsc->data[SC_SHIELDSPELL_REF]->val1 == 1 && damage > 0) skill->break_equip(bl,EQP_ARMOR,10000,BCT_ENEMY ); if (tsc->data[SC_STYLE_CHANGE] && rnd()%2) { - TBL_HOM *hd = BL_CAST(BL_HOM,bl); + struct homun_data *hd = BL_CAST(BL_HOM,bl); if (hd) homun->addspiritball(hd, 10); } if (src->type == BL_PC && damage > 0 && (sce = tsc->data[SC_GENTLETOUCH_ENERGYGAIN]) != NULL) { @@ -4860,7 +4860,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list break; case HFLI_SBR44: //[orn] if(src->type == BL_HOM) { - wd.damage = ((TBL_HOM*)src)->homunculus.intimacy ; + wd.damage = ((struct homun_data *)src)->homunculus.intimacy; break; } default: @@ -5166,8 +5166,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } #endif if(sc->data[SC_STYLE_CHANGE]){ - TBL_HOM *hd = BL_CAST(BL_HOM,src); - if (hd) ATK_ADD(hd->homunculus.spiritball * 3); + struct homun_data *hd = BL_CAST(BL_HOM, src); + if (hd != NULL) + ATK_ADD(hd->homunculus.spiritball * 3); } } @@ -6396,8 +6397,8 @@ struct block_list* battle_get_master(struct block_list *src) { src = map->id2bl(((struct mob_data *)src)->master_id); break; case BL_HOM: - if (((TBL_HOM*)src)->master) - src = (struct block_list*)((TBL_HOM*)src)->master; + if (((struct homun_data *)src)->master != NULL) + src = (struct block_list *)((struct homun_data *)src)->master; break; case BL_MER: if (((TBL_MER*)src)->master) diff --git a/src/map/battleground.c b/src/map/battleground.c index 799a502d4..7ac18daf8 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -234,8 +234,8 @@ int bg_team_get_id(struct block_list *bl) { return md->bg_id; } case BL_HOM: - if( ((TBL_HOM*)bl)->master ) - return ((TBL_HOM*)bl)->master->bg_id; + if (((struct homun_data *)bl)->master != NULL) + return ((struct homun_data*)bl)->master->bg_id; break; case BL_MER: if( ((TBL_MER*)bl)->master ) diff --git a/src/map/clif.c b/src/map/clif.c index fa4d2f0bf..5e078b5c9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7016,7 +7016,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) void clif_spiritball(struct block_list *bl) { unsigned char buf[16]; struct map_session_data *sd = BL_CAST(BL_PC,bl); - TBL_HOM *hd = BL_CAST(BL_HOM,bl); + struct homun_data *hd = BL_CAST(BL_HOM,bl); nullpo_retv(bl); @@ -8409,7 +8409,7 @@ void clif_charnameack (int fd, struct block_list *bl) break; //[blackhole89] case BL_HOM: - memcpy(WBUFP(buf,6), ((TBL_HOM*)bl)->homunculus.name, NAME_LENGTH); + memcpy(WBUFP(buf,6), ((struct homun_data *)bl)->homunculus.name, NAME_LENGTH); break; case BL_MER: memcpy(WBUFP(buf,6), ((TBL_MER*)bl)->db->name, NAME_LENGTH); diff --git a/src/map/mob.c b/src/map/mob.c index 8b59cc413..2c7f3a585 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1953,7 +1953,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) } case BL_HOM: { - struct homun_data *hd = (TBL_HOM*)src; + struct homun_data *hd = (struct homun_data *)src; flag = MDLF_HOMUN; if( hd->master ) char_id = hd->master->status.char_id; @@ -2583,7 +2583,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if( src ) { switch( src->type ) { case BL_PET: sd = ((TBL_PET*)src)->msd; break; - case BL_HOM: sd = ((TBL_HOM*)src)->master; break; + case BL_HOM: sd = ((struct homun_data *)src)->master; break; case BL_MER: sd = ((TBL_MER*)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 403619f96..a630f88c2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7626,7 +7626,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { src = &((TBL_PET*)src)->msd->bl; break; case BL_HOM: - src = &((TBL_HOM*)src)->master->bl; + src = &((struct homun_data *)src)->master->bl; break; case BL_MER: src = &((TBL_MER*)src)->master->bl; diff --git a/src/map/script.c b/src/map/script.c index 1cba7b029..65dcba2f9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -16387,7 +16387,7 @@ BUILDIN(rid2name) { 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; - case BL_HOM: script_pushstrcopy(st,((TBL_HOM*)bl)->homunculus.name); break; + case BL_HOM: script_pushstrcopy(st, ((struct homun_data *)bl)->homunculus.name); break; case BL_MER: script_pushstrcopy(st,((TBL_MER*)bl)->db->name); break; default: ShowError("buildin_rid2name: BL type unknown.\n"); diff --git a/src/map/skill.c b/src/map/skill.c index 341f94204..cd46aaa6a 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -383,7 +383,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk #endif // RENEWAL if (sd && (skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) hp += hp * skill2_lv * 2 / 100; - else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 ) + else if (src->type == BL_HOM && (skill2_lv = homun->checkskill(((struct homun_data *)src), HLIF_BRAIN)) > 0) hp += hp * skill2_lv * 2 / 100; break; } @@ -1765,8 +1765,8 @@ int skill_counter_additional_effect(struct block_list* src, struct block_list *b break; case HFLI_SBR44: // [orn] case HVAN_EXPLOSION: - if(src->type == BL_HOM){ - TBL_HOM *hd = (TBL_HOM*)src; + if (src->type == BL_HOM) { + struct homun_data *hd = (struct homun_data *)src; hd->homunculus.intimacy = 200; if (hd->master) clif->send_homdata(hd->master,SP_INTIMATE,hd->homunculus.intimacy/100); @@ -3092,7 +3092,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, nullpo_ret(bl); switch( bl->type ) { - case BL_HOM: sd = ((TBL_HOM*)bl)->master; break; + case BL_HOM: sd = ((struct homun_data *)bl)->master; break; case BL_MER: sd = ((TBL_MER*)bl)->master; break; } @@ -18028,7 +18028,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) } int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) { // [orn] - struct homun_data *hd = (TBL_HOM*)map->id2bl(id); + struct homun_data *hd = (struct homun_data *)map->id2bl(id); if (data <= 0 || data >= MAX_SKILL) return 0; if (hd) hd->blockskill[data] = 0; diff --git a/src/map/status.c b/src/map/status.c index da318b14f..777ff5fea 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1418,7 +1418,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((struct mob_data *)target, src, hp); break; - case BL_HOM: homun->damaged((TBL_HOM*)target); break; + case BL_HOM: homun->damaged((struct homun_data *)target); break; case BL_MER: mercenary->heal((TBL_MER*)target,hp,sp); break; case BL_ELEM: elemental->heal((TBL_ELEM*)target,hp,sp); break; } @@ -1444,7 +1444,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, switch (target->type) { case BL_PC: flag = pc->dead((struct map_session_data *)target, src); 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_HOM: flag = homun->dead((struct homun_data *)target); break; case BL_MER: flag = mercenary->dead((TBL_MER*)target); break; case BL_ELEM: flag = elemental->dead((TBL_ELEM*)target); break; default: //Unhandled case, do nothing to object. @@ -1584,7 +1584,7 @@ int status_heal(struct block_list *bl,int64 in_hp,int64 in_sp, int flag) { 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((struct mob_data *)bl,hp); break; - case BL_HOM: homun->healed((TBL_HOM*)bl); break; + case BL_HOM: homun->healed((struct homun_data *)bl); break; case BL_MER: mercenary->heal((TBL_MER*)bl,hp,sp); break; case BL_ELEM: elemental->heal((TBL_ELEM*)bl,hp,sp); break; } @@ -1681,7 +1681,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((struct mob_data *)bl, hp); break; - case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break; + case BL_HOM: homun->revive((struct homun_data *)bl, hp, sp); break; } return 1; } @@ -1716,7 +1716,7 @@ int status_fixed_revive(struct block_list *bl, unsigned int per_hp, unsigned int switch (bl->type) { case BL_PC: pc->revive((struct map_session_data *)bl, hp, sp); break; case BL_MOB: mob->revive((struct mob_data *)bl, hp); break; - case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break; + case BL_HOM: homun->revive((struct homun_data *)bl, hp, sp); break; } return 1; } @@ -3437,7 +3437,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *st, struct reg } if( bl->type == BL_HOM ) { - struct homun_data *hd = (TBL_HOM*)bl; + struct homun_data *hd = (struct homun_data *)bl; if( (skill_lv = homun->checkskill(hd,HAMI_SKIN)) > 0 ) { val = regen->hp*(100+5*skill_lv)/100; regen->hp = cap_value(val, 1, SHRT_MAX); @@ -3761,8 +3761,8 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { if( bl->type&BL_PC && !(sd && sd->state.permanent_speed) && st->speed < battle_config.max_walk_speed ) st->speed = battle_config.max_walk_speed; - if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master) - st->speed = status->get_speed(&((TBL_HOM*)bl)->master->bl); + if (bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((struct homun_data *)bl)->master != NULL) + st->speed = status->get_speed(&((struct homun_data *)bl)->master->bl); } if(flag&SCB_CRI && bst->cri) { @@ -3878,11 +3878,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { int amotion; if ( bl->type&BL_HOM ) { #ifdef RENEWAL - amotion = ((TBL_HOM*)bl)->homunculusDB->baseASPD; + amotion = ((struct homun_data *)bl)->homunculusDB->baseASPD; amotion = amotion - amotion * status_get_homdex(bl) / 1000 - status_get_homagi(bl) * amotion / 250; amotion = (amotion * status->calc_aspd(bl, sc, 1) + status->calc_aspd(bl, sc, 2)) / -100 + amotion; #else - amotion = (1000 - 4 * st->agi - st->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD / 1000; + amotion = (1000 - 4 * st->agi - st->dex) * ((struct homun_data *)bl)->homunculusDB->baseASPD / 1000; amotion = status->calc_aspd_rate(bl, sc, amotion); @@ -4072,8 +4072,8 @@ void status_calc_bl_(struct block_list *bl, enum scb_flag flag, enum e_status_ca clif->updatestatus(sd,SP_ATK2); #endif } else if( bl->type == BL_HOM ) { - TBL_HOM* hd = BL_CAST(BL_HOM, bl); - if( hd->master && memcmp(&bst, st, sizeof(struct status_data)) != 0 ) + struct homun_data *hd = BL_CAST(BL_HOM, bl); + if (hd->master != NULL && memcmp(&bst, st, sizeof(struct status_data)) != 0) clif->hominfo(hd->master,hd,0); } else if( bl->type == BL_MER ) { TBL_MER* md = BL_CAST(BL_MER, bl); @@ -4244,7 +4244,7 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_ // [Skotlex] #ifdef RENEWAL if ( bl->type == BL_HOM ) - str = 2 * (((TBL_HOM*)bl)->homunculus.level + status_get_homstr(bl)); + str = 2 * (((struct homun_data *)bl)->homunculus.level + status_get_homstr(bl)); #else dstr = str / 10; str += dstr*dstr; @@ -6208,7 +6208,7 @@ const char* status_get_name(struct block_list *bl) { 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_HOM: return ((TBL_HOM*)bl)->homunculus.name; + case BL_HOM: return ((struct homun_data *)bl)->homunculus.name; case BL_NPC: return ((TBL_NPC*)bl)->name; } return "Unknown"; @@ -6226,7 +6226,7 @@ int status_get_class(struct block_list *bl) { 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_HOM: return ((TBL_HOM*)bl)->homunculus.class_; + case BL_HOM: return ((struct homun_data *)bl)->homunculus.class_; case BL_MER: return ((TBL_MER*)bl)->mercenary.class_; case BL_NPC: return ((TBL_NPC*)bl)->class_; case BL_ELEM: return ((TBL_ELEM*)bl)->elemental.class_; @@ -6245,7 +6245,7 @@ int status_get_lv(struct block_list *bl) { 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_HOM: return ((TBL_HOM*)bl)->homunculus.level; + case BL_HOM: return ((struct homun_data *)bl)->homunculus.level; case BL_MER: return ((TBL_MER*)bl)->db->lv; case BL_ELEM: return ((TBL_ELEM*)bl)->db->lv; case BL_NPC: return ((TBL_NPC*)bl)->level; @@ -6258,7 +6258,7 @@ struct regen_data *status_get_regen_data(struct block_list *bl) nullpo_retr(NULL, bl); switch (bl->type) { case BL_PC: return &((struct map_session_data *)bl)->regen; - case BL_HOM: return &((TBL_HOM*)bl)->regen; + case BL_HOM: return &((struct homun_data *)bl)->regen; case BL_MER: return &((TBL_MER*)bl)->regen; case BL_ELEM: return &((TBL_ELEM*)bl)->regen; default: @@ -6274,7 +6274,7 @@ struct status_data *status_get_status_data(struct block_list *bl) 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_HOM: return &((TBL_HOM*)bl)->battle_status; + case BL_HOM: return &((struct homun_data *)bl)->battle_status; case BL_MER: return &((TBL_MER*)bl)->battle_status; case BL_ELEM: return &((TBL_ELEM*)bl)->battle_status; case BL_NPC: return ((mob->db_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : &status->dummy); @@ -6290,7 +6290,7 @@ struct status_data *status_get_base_status(struct block_list *bl) 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_HOM: return &((TBL_HOM*)bl)->base_status; + case BL_HOM: return &((struct homun_data *)bl)->base_status; case BL_MER: return &((TBL_MER*)bl)->base_status; case BL_ELEM: return &((TBL_ELEM*)bl)->base_status; case BL_NPC: return ((mob->db_checkid(((TBL_NPC*)bl)->class_) == 0) ? &((TBL_NPC*)bl)->status : NULL); @@ -6336,8 +6336,8 @@ int status_get_party_id(struct block_list *bl) { } break; case BL_HOM: - if (((TBL_HOM*)bl)->master) - return ((TBL_HOM*)bl)->master->status.party_id; + if (((struct homun_data *)bl)->master != NULL) + return ((struct homun_data *)bl)->master->status.party_id; break; case BL_MER: if (((TBL_MER*)bl)->master) @@ -6377,8 +6377,8 @@ int status_get_guild_id(struct block_list *bl) { break; } case BL_HOM: - if (((TBL_HOM*)bl)->master) - return ((TBL_HOM*)bl)->master->status.guild_id; + if (((struct homun_data *)bl)->master != NULL) + return ((struct homun_data *)bl)->master->status.guild_id; break; case BL_MER: if (((TBL_MER*)bl)->master) @@ -6420,8 +6420,8 @@ int status_get_emblem_id(struct block_list *bl) { } break; case BL_HOM: - if (((TBL_HOM*)bl)->master) - return ((TBL_HOM*)bl)->master->guild_emblem_id; + if (((struct homun_data *)bl)->master) + return ((struct homun_data *)bl)->master->guild_emblem_id; break; case BL_MER: if (((TBL_MER*)bl)->master) @@ -6484,7 +6484,7 @@ struct view_data* status_get_viewdata(struct block_list *bl) 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; + case BL_HOM: return ((struct homun_data *)bl)->vd; case BL_MER: return ((TBL_MER*)bl)->vd; case BL_ELEM: return ((TBL_ELEM*)bl)->vd; } @@ -6610,13 +6610,13 @@ void status_set_viewdata(struct block_list *bl, int class_) } break; case BL_HOM: //[blackhole89] - { - struct homun_data *hd = (struct homun_data*)bl; - if (vd) - hd->vd = vd; - else - ShowError("status_set_viewdata (HOMUNCULUS): No view data for class %d\n", class_); - } + { + struct homun_data *hd = (struct homun_data *)bl; + if (vd != NULL) + hd->vd = vd; + else + ShowError("status_set_viewdata (HOMUNCULUS): No view data for class %d\n", class_); + } break; case BL_MER: { @@ -6646,7 +6646,7 @@ struct status_change *status_get_sc(struct block_list *bl) { case BL_PC: return &((struct map_session_data *)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_HOM: return &((struct homun_data *)bl)->sc; case BL_MER: return &((TBL_MER*)bl)->sc; case BL_ELEM: return &((TBL_ELEM*)bl)->sc; } diff --git a/src/map/unit.c b/src/map/unit.c index 9fb1c24fd..fefa494fc 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -2784,7 +2784,7 @@ int unit_free(struct block_list *bl, clr_type clrtype) { } case BL_HOM: { - struct homun_data *hd = (TBL_HOM*)bl; + struct homun_data *hd = (struct homun_data *)bl; struct map_session_data *sd = hd->master; homun->hunger_timer_delete(hd); if( hd->homunculus.intimacy > 0 ) |