diff options
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 8053944f9ea..64fdc7d845d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8152,10 +8152,19 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if (m_attacking == victim) { // switch to melee attack from ranged/magic - if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) ) + if(meleeAttack) { - addUnitState(UNIT_STAT_MELEE_ATTACKING); - SendMeleeAttackStart(victim); + if(!hasUnitState(UNIT_STAT_MELEE_ATTACKING)) + { + addUnitState(UNIT_STAT_MELEE_ATTACKING); + SendMeleeAttackStart(victim); + return true; + } + } + else if(hasUnitState(UNIT_STAT_MELEE_ATTACKING)) + { + clearUnitState(UNIT_STAT_MELEE_ATTACKING); + SendMeleeAttackStop(victim); return true; } return false; |