summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorLeo Pflug <skyleo@skyleo.de>2019-10-30 18:18:09 +0100
committerHaru <haru@dotalux.com>2020-03-08 20:59:35 +0100
commit3077a395f8ff1bc86972914f2f94d58e893e2aa7 (patch)
treeb878c5febaf154e9f6a66e5ac04be63c6c3c9e9f /src/map
parentbc0b77acd3e6565653b3efadaab695189beddd72 (diff)
downloadhercules-3077a395f8ff1bc86972914f2f94d58e893e2aa7.tar.gz
hercules-3077a395f8ff1bc86972914f2f94d58e893e2aa7.tar.bz2
hercules-3077a395f8ff1bc86972914f2f94d58e893e2aa7.tar.xz
hercules-3077a395f8ff1bc86972914f2f94d58e893e2aa7.zip
Execute map->freeblock_unlock() if assertion fails
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index d0affb248..eb9efa071 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -3338,7 +3338,10 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
case SR_KNUCKLEARROW:
if( skill->blown(dsrc,bl,dmg.blewcount,dir,0) && !(flag&4) ) {
short dir_x, dir_y;
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
dir_x = dirx[unit_get_opposite_dir(dir)];
dir_y = diry[unit_get_opposite_dir(dir)];
if (map->getcell(bl->m, bl, bl->x + dir_x, bl->y + dir_y, CELL_CHKNOPASS) != 0)
@@ -4762,7 +4765,10 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
ty = bl->y;
for(i=0;i<c;i++) {
// Target coordinates (get changed even if knockback fails)
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
tx -= dirx[dir];
ty -= diry[dir];
// If target cell is a wall then break
@@ -4805,7 +4811,10 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
for (i=0;i<4;i++) {
map->foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR,src,skill_id,skill_lv,
tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
x += dirx[dir];
y += diry[dir];
}
@@ -5050,7 +5059,10 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
case GC_DARKILLUSION:
{
enum unit_dir dir = map->calc_dir(bl, src->x, src->y);
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
short x = bl->x + dirx[dir];
short y = bl->y + diry[dir];
@@ -5211,7 +5223,10 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
case RA_WUGSTRIKE:
if (sd != NULL && pc_isridingwug(sd)) {
enum unit_dir dir = map->calc_dir(bl, src->x, src->y);
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
short x = bl->x + dirx[dir];
short y = bl->y + diry[dir];
if (unit->movepos(src, x, y, 1, 1) != 0) {
@@ -8081,7 +8096,10 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
dir = unit->getdir(src);
else
dir = map->calc_dir(src, bl->x, bl->y);
- Assert_ret(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX);
+ if (Assert_chk(dir >= UNIT_DIR_FIRST && dir < UNIT_DIR_MAX)) {
+ map->freeblock_unlock(); // unblock before assert-returning
+ return 0;
+ }
unit->stop_attack(src);
//Run skillv tiles overriding the can-move check.
if (unit->walktoxy(src, (src->x + skill_lv * -dirx[dir]),