summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorHaru <haru@originsro.org>2013-06-20 04:10:26 +0200
committerHaru <haru@originsro.org>2013-06-20 04:10:26 +0200
commit99cd190d67a35b1d8ea976247cdbd3ebdfb1155c (patch)
tree57df9e90f12f5ab81bb2db001858f9896d34d14d /src/map/battle.c
parent594e30964ea4421654fd636e35b046aabd4df9ac (diff)
downloadhercules-99cd190d67a35b1d8ea976247cdbd3ebdfb1155c.tar.gz
hercules-99cd190d67a35b1d8ea976247cdbd3ebdfb1155c.tar.bz2
hercules-99cd190d67a35b1d8ea976247cdbd3ebdfb1155c.tar.xz
hercules-99cd190d67a35b1d8ea976247cdbd3ebdfb1155c.zip
Fixed an unsafe TBL_PC* cast in battle_calc_elefix
This would cause a mapserver crash whenever the function was called by a monster attack. The issue was introduced in 03956104
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index ace947aca..800d573a2 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -820,7 +820,7 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16
{ // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex]
damage =
#ifndef RENEWAL
- battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0))
+ battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0))
#else
battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0)
#endif
@@ -830,7 +830,7 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16
if( left ){
damage =
#ifndef RENEWAL
- battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, ((TBL_PC*)src), (flag?2:0))
+ battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0))
#else
battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0)
#endif