summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-31 12:39:54 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-31 12:39:54 +0000
commit7d014932d263c908529db8ad3d7b48a7ea01d0ec (patch)
tree068f1cb446328f4e6b80f39067490d2fc87578b9 /src/map
parent748d2dbd9c453603ebf8968c9a747372b530da33 (diff)
downloadhercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.gz
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.bz2
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.tar.xz
hercules-7d014932d263c908529db8ad3d7b48a7ea01d0ec.zip
* 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
Diffstat (limited to 'src/map')
-rw-r--r--src/map/pc.c4
-rw-r--r--src/map/script.c6
-rw-r--r--src/map/skill.c12
3 files changed, 15 insertions, 7 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 53d5277a6..e13e25ad2 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1541,7 +1541,7 @@ static int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id,
if (!(flag&(ATF_TARGET|ATF_SELF)))
flag|=ATF_TARGET; //Default target: enemy.
if (!(flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)))
- flag|=ATF_WEAPON; //Defatul type: weapon.
+ flag|=ATF_WEAPON; //Default type: weapon.
for (i = 0; i < max && effect[i].flag; i++) {
if (effect[i].id == id && effect[i].flag == flag)
@@ -2935,7 +2935,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
break;
}
if( sd->state.lr_flag != 2 )
- pc_bonus_addeff_onskill(sd->addeff3, ARRAYLENGTH(sd->addeff3), (sc_type)type3, val, type2, 2);
+ pc_bonus_addeff_onskill(sd->addeff3, ARRAYLENGTH(sd->addeff3), (sc_type)type3, val, type2, ATF_TARGET);
break;
case SP_ADDELE:
diff --git a/src/map/script.c b/src/map/script.c
index f842b614a..5c87336c3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -14635,9 +14635,6 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
if( md->class_ != mobid )
return 0;
- if( md->ud.skilltimer != INVALID_TIMER ) // Cancel the casting skill.
- unit_skillcastcancel(bl,0);
-
// 0:self, 1:target, 2:master, default:random
switch( target )
{
@@ -14650,6 +14647,9 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
if( !tbl )
return 0;
+ if( md->ud.skilltimer != INVALID_TIMER ) // Cancel the casting skill.
+ unit_skillcastcancel(bl,0);
+
if( skill_get_casttype(skillid) == CAST_GROUND )
unit_skilluse_pos2(&md->bl, tbl->x, tbl->y, skillid, skilllv, casttime, cancel);
else
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;