[9206] Some code cleanups.

* UNIT_STAT_SEARCHING not used
* Remove some commented wrong code
* WaypointMovementGenerator<Creature>::Initialize() not have code
This commit is contained in:
VladimirMangos 2010-01-18 09:10:41 +03:00
parent 544d396beb
commit 98adbbc3d3
8 changed files with 7 additions and 23 deletions

View file

@ -71,7 +71,7 @@ inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPo
pl->UpdateVisibilityOf(viewPoint,c); pl->UpdateVisibilityOf(viewPoint,c);
// Creature AI reaction // Creature AI reaction
if(!c->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) if(!c->hasUnitState(UNIT_STAT_FLEEING))
{ {
if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() ) if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() )
c->AI()->MoveInLineOfSight(pl); c->AI()->MoveInLineOfSight(pl);
@ -80,13 +80,13 @@ inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPo
inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
{ {
if(!c1->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) if(!c1->hasUnitState(UNIT_STAT_FLEEING))
{ {
if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() ) if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() )
c1->AI()->MoveInLineOfSight(c2); c1->AI()->MoveInLineOfSight(c2);
} }
if(!c2->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) if(!c2->hasUnitState(UNIT_STAT_FLEEING))
{ {
if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() ) if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() )
c2->AI()->MoveInLineOfSight(c1); c2->AI()->MoveInLineOfSight(c1);

View file

@ -5571,7 +5571,6 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break; case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break;
case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break; case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break;
case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break; case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
case CHASE_MOTION_TYPE: case CHASE_MOTION_TYPE:
{ {
Unit* target = NULL; Unit* target = NULL;

View file

@ -4044,9 +4044,6 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
m_target->addUnitState(UNIT_STAT_ROOT); m_target->addUnitState(UNIT_STAT_ROOT);
m_target->SetTargetGUID(0); m_target->SetTargetGUID(0);
// probably wrong (this add skinnable flag)
// TODO: find correct flag
//m_target->SetFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
//Save last orientation //Save last orientation
if( m_target->getVictim() ) if( m_target->getVictim() )
@ -4095,9 +4092,6 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
return; return;
m_target->clearUnitState(UNIT_STAT_ROOT); m_target->clearUnitState(UNIT_STAT_ROOT);
// probably wrong (this add skinnable flag)
// TODO: find correct flag
//m_target->RemoveFlag(UNIT_FIELD_FLAGS,(apply_stat<<16));
if(!m_target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect if(!m_target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect
{ {
@ -7432,7 +7426,7 @@ void Aura::PeriodicDummyTick()
// Killing Spree // Killing Spree
case 51690: case 51690:
{ {
if (m_target->hasUnitState(UNIT_STAT_STUNNED) || m_target->HasAuraType(SPELL_AURA_MOD_FEAR)) if (m_target->hasUnitState(UNIT_STAT_STUNNED) || m_target->isFeared())
return; return;
std::list<Unit*> targets; std::list<Unit*> targets;

View file

@ -413,9 +413,9 @@ enum UnitState
UNIT_STAT_STUNNED = 0x0008, UNIT_STAT_STUNNED = 0x0008,
UNIT_STAT_ROAMING = 0x0010, UNIT_STAT_ROAMING = 0x0010,
UNIT_STAT_CHASE = 0x0020, UNIT_STAT_CHASE = 0x0020,
UNIT_STAT_SEARCHING = 0x0040, //UNIT_STAT_SEARCHING = 0x0040,
UNIT_STAT_FLEEING = 0x0080, UNIT_STAT_FLEEING = 0x0080,
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING), UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_FLEEING),
UNIT_STAT_IN_FLIGHT = 0x0100, // player is in flight mode UNIT_STAT_IN_FLIGHT = 0x0100, // player is in flight mode
UNIT_STAT_FOLLOW = 0x0200, UNIT_STAT_FOLLOW = 0x0200,
UNIT_STAT_ROOT = 0x0400, UNIT_STAT_ROOT = 0x0400,

View file

@ -74,10 +74,6 @@ void WaypointMovementGenerator<Creature>::ClearWaypoints()
i_path = NULL; i_path = NULL;
} }
void WaypointMovementGenerator<Creature>::Initialize()
{
}
bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff) bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
{ {
if (!&creature) if (!&creature)

View file

@ -104,9 +104,6 @@ public PathMovementBase<Creature, WaypointPath*>
bool IsStoppedByPlayer() { return b_StoppedByPlayer; } bool IsStoppedByPlayer() { return b_StoppedByPlayer; }
void SetStoppedByPlayer(bool val) { b_StoppedByPlayer = val; } void SetStoppedByPlayer(bool val) { b_StoppedByPlayer = val; }
// statics
static void Initialize(void);
// allow use for overwrite empty implementation // allow use for overwrite empty implementation
bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Creature, WaypointPath*>::GetDestination(x,y,z); } bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Creature, WaypointPath*>::GetDestination(x,y,z); }

View file

@ -50,7 +50,6 @@
#include "Policies/SingletonImp.h" #include "Policies/SingletonImp.h"
#include "BattleGroundMgr.h" #include "BattleGroundMgr.h"
#include "TemporarySummon.h" #include "TemporarySummon.h"
#include "WaypointMovementGenerator.h"
#include "VMapFactory.h" #include "VMapFactory.h"
#include "GlobalEvents.h" #include "GlobalEvents.h"
#include "GameEventMgr.h" #include "GameEventMgr.h"
@ -1496,7 +1495,6 @@ void World::SetInitialWorldSettings()
///- Initilize static helper structures ///- Initilize static helper structures
AIRegistry::Initialize(); AIRegistry::Initialize();
WaypointMovementGenerator<Creature>::Initialize();
Player::InitVisibleBits(); Player::InitVisibleBits();
///- Initialize MapManager ///- Initialize MapManager

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9205" #define REVISION_NR "9206"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__