summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-22 09:37:47 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-22 09:37:47 +0000
commit7928947b09b3e7b7f317379d16f9b47299d26cee (patch)
treef11a38cba1034265f427273cbf6196b948bb8a46 /src
parente5b1b4c350134f4304a9d3b4858f99ecf235b31f (diff)
downloadhercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.gz
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.bz2
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.tar.xz
hercules-7928947b09b3e7b7f317379d16f9b47299d26cee.zip
* Changed val4 of SC_BLADESTOP from a block_list pointer to an id. (64bit portability issue and potential dangling pointer crash)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13471 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/clif.c10
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/status.c10
-rw-r--r--src/map/unit.c2
5 files changed, 14 insertions, 16 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 1ac70f77b..4450c3258 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2903,11 +2903,11 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
int skilllv = tsc->data[SC_BLADESTOP_WAIT]->val1;
int duration = skill_get_time2(MO_BLADESTOP,skilllv);
status_change_end(target, SC_BLADESTOP_WAIT, -1);
- if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, (int)target, duration))
+ if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
{ //Target locked.
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
- clif_bladestop(target,src,1);
- sc_start4(target, SC_BLADESTOP, 100, skilllv, 0, 0,(int)src, duration);
+ clif_bladestop(target, src->id, 1);
+ sc_start4(target, SC_BLADESTOP, 100, skilllv, 0, 0, src->id, duration);
return ATK_NONE;
}
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 6038a4947..662cfb580 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5957,22 +5957,18 @@ int clif_combo_delay(struct block_list *bl,int wait)
/*==========================================
*”’nŽæ‚è
*------------------------------------------*/
-int clif_bladestop(struct block_list *src,struct block_list *dst,
- int _bool)
+void clif_bladestop(struct block_list *src, int dst_id, int active)
{
unsigned char buf[32];
nullpo_retr(0, src);
- nullpo_retr(0, dst);
WBUFW(buf,0)=0x1d1;
WBUFL(buf,2)=src->id;
- WBUFL(buf,6)=dst->id;
- WBUFL(buf,10)=_bool;
+ WBUFL(buf,6)=dst_id;
+ WBUFL(buf,10)=active;
clif_send(buf,packet_len(0x1d1),src,AREA);
-
- return 0;
}
/*==========================================
diff --git a/src/map/clif.h b/src/map/clif.h
index e0e100852..b64d94b48 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -236,7 +236,7 @@ int clif_autospell(struct map_session_data *sd,int skilllv);
void clif_devotion(struct block_list *src, struct map_session_data *tsd);
int clif_spiritball(struct map_session_data *sd);
int clif_combo_delay(struct block_list *src,int wait);
-int clif_bladestop(struct block_list *src,struct block_list *dst,int bool_);
+void clif_bladestop(struct block_list* src, int dst_id, int active);
void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target);
int clif_status_load(struct block_list *bl,int type, int flag);
diff --git a/src/map/status.c b/src/map/status.c
index 5b38fd17a..e8da71bcc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4549,9 +4549,10 @@ void status_set_viewdata(struct block_list *bl, int class_)
vd->cloth_color = 0;
}
+/// Returns the status_change data of bl or NULL if it doesn't exist.
struct status_change *status_get_sc(struct block_list *bl)
{
- nullpo_retr(NULL, bl);
+ if( bl )
switch (bl->type) {
case BL_PC: return &((TBL_PC*)bl)->sc;
case BL_MOB: return &((TBL_MOB*)bl)->sc;
@@ -6582,15 +6583,16 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
case SC_BLADESTOP:
if(sce->val4)
{
- struct block_list *tbl = (struct block_list *)sce->val4;
+ int tid = sce->val4;
+ struct block_list *tbl = map_id2bl(tid);
struct status_change *tsc = status_get_sc(tbl);
sce->val4 = 0;
- if(tsc && tsc->data[SC_BLADESTOP])
+ if(tbl && tsc && tsc->data[SC_BLADESTOP])
{
tsc->data[SC_BLADESTOP]->val4 = 0;
status_change_end(tbl,SC_BLADESTOP,-1);
}
- clif_bladestop(bl,tbl,0);
+ clif_bladestop(bl, tid, 0);
}
break;
case SC_DANCING:
diff --git a/src/map/unit.c b/src/map/unit.c
index 787b25765..f79a16664 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -855,7 +855,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, sh
{ //Check for skills that auto-select target
case MO_CHAINCOMBO:
if (sc && sc->data[SC_BLADESTOP]){
- if ((target=(struct block_list *)sc->data[SC_BLADESTOP]->val4) == NULL)
+ if ((target=map_id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL)
return 0;
}
break;