*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)

*Fix a possible crash in Spell::DoAllEffectOnTarget

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 15:35:07 -07:00
parent f21f47005d
commit 26b5e033ff
2257 changed files with 750 additions and 103852 deletions

View File

@@ -17,13 +17,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "IdleMovementGenerator.h"
#include "CreatureAI.h"
#include "Creature.h"
IdleMovementGenerator si_idleMovement;
// StopMoving is needed to make unit stop if its last movement generator expires
// But it should not be sent otherwise there are many redundent packets
void IdleMovementGenerator::Initialize(Unit &owner)
@@ -31,27 +28,21 @@ void IdleMovementGenerator::Initialize(Unit &owner)
if(owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void
IdleMovementGenerator::Reset(Unit& owner)
{
if(owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
}
void RotateMovementGenerator::Initialize(Unit& owner)
{
if(owner.hasUnitState(UNIT_STAT_MOVE))
owner.StopMoving();
if(owner.getVictim())
owner.SetInFront(owner.getVictim());
owner.addUnitState(UNIT_STAT_ROTATING);
owner.AttackStop();
owner.AttackStop();
}
bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
{
float angle = owner.GetOrientation();
@@ -67,44 +58,36 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
}
owner.SetOrientation(angle);
owner.SendMovementFlagUpdate(); // this is a hack. we do not have anything correct to send in the beginning
if(m_duration > diff)
m_duration -= diff;
else
return false;
return true;
}
void RotateMovementGenerator::Finalize(Unit &unit)
{
unit.clearUnitState(UNIT_STAT_ROTATING);
if(unit.GetTypeId() == TYPEID_UNIT)
((Creature*)&unit)->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
}
void
DistractMovementGenerator::Initialize(Unit& owner)
{
owner.addUnitState(UNIT_STAT_DISTRACTED);
}
void
DistractMovementGenerator::Finalize(Unit& owner)
{
owner.clearUnitState(UNIT_STAT_DISTRACTED);
}
bool
DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff)
{
if(time_diff > m_timer)
return false;
m_timer -= time_diff;
return true;
}
void
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
{