summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-10 22:40:50 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-02-10 22:40:50 +0000
commit9f3e6d6b0350a2f8f7e1f47c85919801e25d3401 (patch)
tree51c4a045ebc4db6a7c22a3539cb382a7aaf7293c /src
parentf07b3c7434028984cf6665fdf0d0759c26f37674 (diff)
downloadhercules-9f3e6d6b0350a2f8f7e1f47c85919801e25d3401.tar.gz
hercules-9f3e6d6b0350a2f8f7e1f47c85919801e25d3401.tar.bz2
hercules-9f3e6d6b0350a2f8f7e1f47c85919801e25d3401.tar.xz
hercules-9f3e6d6b0350a2f8f7e1f47c85919801e25d3401.zip
Fixed Warp Portal code sometimes producing errors/crashes in the case where a priest enters his/her own warp (bugreport:270)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12189 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/skill.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 064b6d2d5..b42bb13cc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6530,11 +6530,17 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if(bl->type==BL_PC){
struct map_session_data *sd = (struct map_session_data *)bl;
if((!sd->chatID || battle_config.chat_warpportal)
- && sd->ud.to_x == src->bl.x && sd->ud.to_y == src->bl.y) {
- if (pc_setpos(sd,sg->val3,sg->val2>>16,sg->val2&0xffff,3) == 0) {
- if (--sg->val1<=0)
- skill_delunitgroup(NULL, sg);
- }
+ && sd->ud.to_x == src->bl.x && sd->ud.to_y == src->bl.y)
+ {
+ int x = sg->val2>>16;
+ int y = sg->val2&0xffff;
+ unsigned short m = sg->val3;
+
+ if( --sg->val1 <= 0 )
+ skill_delunitgroup(NULL, sg);
+
+ pc_setpos(sd,m,x,y,3);
+ sg = src->group; // avoid dangling pointer (pc_setpos can cause deletion of 'sg')
}
} else
if(bl->type == BL_MOB && battle_config.mob_warp&2)