From 7d014932d263c908529db8ad3d7b48a7ea01d0ec Mon Sep 17 00:00:00 2001 From: ai4rei Date: Mon, 31 Jan 2011 12:39:54 +0000 Subject: * Various accumulated cleanups and fixes. - Improved the compile speed for files which include common/socket.h on windows builds (related r10471). - Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting). - Fixed script command 'areamobuseskill' canceling monster's skill cast before it determined it's new target, which could be 'none' (bugreport:3272, since r13897). - Added a protection against attempts to read an empty backup / write to a full backup in skill_dance_switch as per TODO from r11347. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14690 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/skill.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/map/skill.c') diff --git a/src/map/skill.c b/src/map/skill.c index cd9115df4..ffb5a1826 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6754,15 +6754,23 @@ int skill_dance_overlap(struct skill_unit* unit, int flag) *------------------------------------------*/ static bool skill_dance_switch(struct skill_unit* unit, int flag) { + static int prevflag = 1; // by default the backup is empty static struct skill_unit_group backup; struct skill_unit_group* group = unit->group; - //TODO: add protection against attempts to read an empty backup / write to a full backup - // val2&UF_ENSEMBLE is a hack to indicate dissonance if ( !(group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) ) return false; + if( flag == prevflag ) + {// protection against attempts to read an empty backup / write to a full backup + ShowError("skill_dance_switch: Attempted to %s (skill_id=%d, skill_lv=%d, src_id=%d).\n", + flag ? "read an empty backup" : "write to a full backup", + group->skill_id, group->skill_lv, group->src_id); + return false; + } + prevflag = flag; + if( !flag ) { //Transform int skillid = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE; -- cgit v1.2.3-60-g2f50