From 8921a3023de5519f0e0af164d71023914c8656f3 Mon Sep 17 00:00:00 2001 From: ultramage Date: Mon, 10 Sep 2007 20:50:55 +0000 Subject: * Added a safeguard to skill_get_unit_layout() against incorrectly defined layout ids (will give weird results but won't crash at least) * Fixed Firewall/Icewall being oriented backwards (no real difference though...) * Removed some junk Landprotector/Graffiti code; Graffiti doesn't get placed randomly anymore * Icewall can now be cast on yourself... but for some reason, the cell on yourself immediately expires! * Merged together functions clif_set0192() and clif_changemapcell() - also removed its "send to whole map" mode which is just plain wrong (although aegis actually does use it to 'inform' caster about changes) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11175 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 69 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 16b6f19f0..d95495c1a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -640,7 +640,7 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd) clif_send(buf, packet_len(0xa1), &fitem->bl, AREA); } else { WFIFOHEAD(fd,packet_len(0xa1)); - memcpy(WFIFOP(fd,0), buf, 6); + memcpy(WFIFOP(fd,0), buf, packet_len(0xa1)); WFIFOSET(fd,packet_len(0xa1)); } @@ -1184,20 +1184,6 @@ static void clif_spiritball_single(int fd, struct map_session_data *sd) WFIFOSET(fd, packet_len(0x1e1)); } -/*========================================== - * - *------------------------------------------*/ -static void clif_set0192(int fd, int m, int x, int y, int type) -{ - WFIFOHEAD(fd,packet_len(0x192)); - WFIFOW(fd,0) = 0x192; - WFIFOW(fd,2) = x; - WFIFOW(fd,4) = y; - WFIFOW(fd,6) = type; - mapindex_getmapname_ext(map[m].name, (char*)WFIFOP(fd,8)); - WFIFOSET(fd,packet_len(0x192)); -} - // new and improved weather display [Valaris] static void clif_weather_sub(int fd, int id, int type) { @@ -3905,6 +3891,33 @@ void clif_standing(struct block_list* bl) } } +/*========================================== + * + *------------------------------------------*/ +void clif_changemapcell(int fd, short m, short x, short y, int type) +{ + unsigned char buf[32]; + + WBUFW(buf,0) = 0x192; + WBUFW(buf,2) = x; + WBUFW(buf,4) = y; + WBUFW(buf,6) = type; + mapindex_getmapname_ext(map[m].name,(char*)WBUFP(buf,8)); + + if (fd == 0) { + struct block_list bl; + bl.type = BL_NUL; + bl.m = m; + bl.x = x; + bl.y = y; + clif_send(buf,packet_len(0x192),&bl,AREA); + } else { + WFIFOHEAD(fd,packet_len(0x192)); + memcpy(WFIFOP(fd,0), buf, packet_len(0x192)); + WFIFOSET(fd,packet_len(0x192)); + } +} + /*========================================== * *------------------------------------------*/ @@ -3948,7 +3961,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un WFIFOL(fd, 2)=unit->bl.id; WFIFOL(fd, 6)=unit->group->src_id; WFIFOW(fd,10)=unit->bl.x; - WFIFOW(fd,12)=unit->bl.y; // might be typo? [Lance] + WFIFOW(fd,12)=unit->bl.y; WFIFOB(fd,14)=unit->group->unit_id; WFIFOB(fd,15)=1; WFIFOB(fd,16)=1; @@ -3973,7 +3986,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,struct skill_unit *un WFIFOSET(fd,packet_len(0x11f)); if(unit->group->skill_id == WZ_ICEWALL) - clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,5); + clif_changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,5); return 0; /* Previous implementation guess of packet 0x1c9, who can understand what all those fields are for? [Skotlex] WFIFOHEAD(fd,packet_len(0x1c9)); @@ -4034,7 +4047,7 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd) WFIFOL(fd, 2)=unit->bl.id; WFIFOSET(fd,packet_len(0x120)); if(unit->group && unit->group->skill_id == WZ_ICEWALL) - clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2); + clif_changemapcell(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2); return 0; } @@ -6354,26 +6367,6 @@ int clif_bladestop(struct block_list *src,struct block_list *dst, return 0; } -/*========================================== - * - *------------------------------------------*/ -void clif_changemapcell(short m, short x, short y, int cell_type, int type) -{ - struct block_list bl; - unsigned char buf[32]; - - bl.type = BL_NUL; - bl.m = m; - bl.x = x; - bl.y = y; - WBUFW(buf,0) = 0x192; - WBUFW(buf,2) = x; - WBUFW(buf,4) = y; - WBUFW(buf,6) = cell_type; - mapindex_getmapname_ext(map[m].name,(char*)WBUFP(buf,8)); - clif_send(buf,packet_len(0x192),&bl,(!type)?AREA:ALL_SAMEMAP); -} - /*========================================== * MVPエフェクト *------------------------------------------*/ -- cgit v1.2.3-70-g09d2