Core/Cleanup:
Mostly if(.. -> if (.. and for(.. -> for (.. but also some miscellaneous cleanup
This commit is contained in:
@@ -27,8 +27,7 @@
|
|||||||
#include "GridNotifiersImpl.h"
|
#include "GridNotifiersImpl.h"
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
|
|
||||||
int
|
int TotemAI::Permissible(Creature const* creature)
|
||||||
TotemAI::Permissible(const Creature* creature)
|
|
||||||
{
|
{
|
||||||
if (creature->isTotem())
|
if (creature->isTotem())
|
||||||
return PERMIT_BASE_PROACTIVE;
|
return PERMIT_BASE_PROACTIVE;
|
||||||
@@ -41,8 +40,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
|
|||||||
ASSERT(c->isTotem());
|
ASSERT(c->isTotem());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::MoveInLineOfSight(Unit* /*who*/)
|
||||||
TotemAI::MoveInLineOfSight(Unit*)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,8 +49,7 @@ void TotemAI::EnterEvadeMode()
|
|||||||
me->CombatStop(true);
|
me->CombatStop(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::UpdateAI(uint32 const /*diff*/)
|
||||||
TotemAI::UpdateAI(const uint32 /*diff*/)
|
|
||||||
{
|
{
|
||||||
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
|
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
|
||||||
return;
|
return;
|
||||||
@@ -98,8 +95,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
|
|||||||
i_victimGuid = 0;
|
i_victimGuid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TotemAI::AttackStart(Unit* /*victim*/)
|
||||||
TotemAI::AttackStart(Unit*)
|
|
||||||
{
|
{
|
||||||
// Sentry totem sends ping on attack
|
// Sentry totem sends ping on attack
|
||||||
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ class TotemAI : public CreatureAI
|
|||||||
|
|
||||||
explicit TotemAI(Creature* c);
|
explicit TotemAI(Creature* c);
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit*);
|
void MoveInLineOfSight(Unit* who);
|
||||||
void AttackStart(Unit*);
|
void AttackStart(Unit* victim);
|
||||||
void EnterEvadeMode();
|
void EnterEvadeMode();
|
||||||
|
|
||||||
void UpdateAI(const uint32);
|
void UpdateAI(uint32 const diff);
|
||||||
static int Permissible(const Creature*);
|
static int Permissible(Creature const* creature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64 i_victimGuid;
|
uint64 i_victimGuid;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace FactorySelector
|
|||||||
{
|
{
|
||||||
const CreatureAICreator* factory = iter->second;
|
const CreatureAICreator* factory = iter->second;
|
||||||
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
|
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
|
||||||
ASSERT(p != NULL);
|
ASSERT(p);
|
||||||
int val = p->Permit(creature);
|
int val = p->Permit(creature);
|
||||||
if (val > best_val)
|
if (val > best_val)
|
||||||
{
|
{
|
||||||
@@ -102,7 +102,7 @@ namespace FactorySelector
|
|||||||
MovementGenerator* selectMovementGenerator(Creature* creature)
|
MovementGenerator* selectMovementGenerator(Creature* creature)
|
||||||
{
|
{
|
||||||
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
|
||||||
ASSERT(creature->GetCreatureTemplate() != NULL);
|
ASSERT(creature->GetCreatureTemplate());
|
||||||
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
|
||||||
|
|
||||||
/* if (mv_factory == NULL)
|
/* if (mv_factory == NULL)
|
||||||
|
|||||||
@@ -1494,7 +1494,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
if (ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
|
||||||
bonusPct += (*itr)->GetAmount();
|
bonusPct += (*itr)->GetAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1504,6 +1504,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
|
|||||||
maxArmorPen = float(400 + 85 * victim->getLevel());
|
maxArmorPen = float(400 + 85 * victim->getLevel());
|
||||||
else
|
else
|
||||||
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
|
||||||
|
|
||||||
// Cap armor penetration to this number
|
// Cap armor penetration to this number
|
||||||
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
|
||||||
// Figure out how much armor do we ignore
|
// Figure out how much armor do we ignore
|
||||||
|
|||||||
@@ -96,26 +96,26 @@ void MapManager::checkAndCorrectGridStatesArray()
|
|||||||
|
|
||||||
Map* MapManager::CreateBaseMap(uint32 id)
|
Map* MapManager::CreateBaseMap(uint32 id)
|
||||||
{
|
{
|
||||||
Map* m = FindBaseMap(id);
|
Map* map = FindBaseMap(id);
|
||||||
|
|
||||||
if (m == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
||||||
|
|
||||||
const MapEntry* entry = sMapStore.LookupEntry(id);
|
const MapEntry* entry = sMapStore.LookupEntry(id);
|
||||||
if (entry && entry->Instanceable())
|
if (entry && entry->Instanceable())
|
||||||
{
|
{
|
||||||
m = new MapInstanced(id, i_gridCleanUpDelay);
|
map = new MapInstanced(id, i_gridCleanUpDelay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
|
map = new Map(id, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY);
|
||||||
}
|
}
|
||||||
i_maps[id] = m;
|
i_maps[id] = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(m != NULL);
|
ASSERT(map);
|
||||||
return m;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
|
Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ enum SpellAttr3
|
|||||||
|
|
||||||
enum SpellAttr4
|
enum SpellAttr4
|
||||||
{
|
{
|
||||||
SPELL_ATTR4_IGNORE_RESISTANCES = 0x00000001, // 0 spells with this attribute will completely ignore the target resistances (theese spells cant be resisted)
|
SPELL_ATTR4_IGNORE_RESISTANCES = 0x00000001, // 0 spells with this attribute will completely ignore the target's resistance (these spells can't be resisted)
|
||||||
SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER?
|
SPELL_ATTR4_PROC_ONLY_ON_CASTER = 0x00000002, // 1 proc only on effects with TARGET_UNIT_CASTER?
|
||||||
SPELL_ATTR4_UNK2 = 0x00000004, // 2
|
SPELL_ATTR4_UNK2 = 0x00000004, // 2
|
||||||
SPELL_ATTR4_UNK3 = 0x00000008, // 3
|
SPELL_ATTR4_UNK3 = 0x00000008, // 3
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
#define MAX_QUIET_DISTANCE 43.0f
|
#define MAX_QUIET_DISTANCE 43.0f
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||||
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -53,8 +52,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||||
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return false;
|
return false;
|
||||||
@@ -187,8 +185,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
||||||
FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
|
||||||
{
|
{
|
||||||
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
|
float cur_dist_xyz = owner.GetDistance(i_caster_x, i_caster_y, i_caster_z);
|
||||||
|
|
||||||
@@ -280,8 +277,7 @@ FleeingMovementGenerator<T>::_setMoveData(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void FleeingMovementGenerator<T>::Initialize(T &owner)
|
||||||
FleeingMovementGenerator<T>::Initialize(T &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -312,8 +308,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
||||||
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
|
||||||
{
|
{
|
||||||
if (!&owner)
|
if (!&owner)
|
||||||
return;
|
return;
|
||||||
@@ -324,8 +319,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void FleeingMovementGenerator<Player>::_Init(Player &)
|
||||||
FleeingMovementGenerator<Player>::_Init(Player &)
|
|
||||||
{
|
{
|
||||||
is_water_ok = true;
|
is_water_ok = true;
|
||||||
is_land_ok = true;
|
is_land_ok = true;
|
||||||
@@ -354,8 +348,7 @@ void FleeingMovementGenerator<T>::Reset(T &owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
bool
|
bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
||||||
FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
|
|
||||||
{
|
{
|
||||||
if (!&owner || !owner.isAlive())
|
if (!&owner || !owner.isAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class FleeingMovementGenerator
|
class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
|
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
|
||||||
@@ -55,8 +54,7 @@ class FleeingMovementGenerator
|
|||||||
TimeTracker i_nextCheckTime;
|
TimeTracker i_nextCheckTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimedFleeingMovementGenerator
|
class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
|
||||||
: public FleeingMovementGenerator<Creature>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
|
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ template < class T >
|
|||||||
class HomeMovementGenerator;
|
class HomeMovementGenerator;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class HomeMovementGenerator<Creature>
|
class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
||||||
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
#include "FollowerReference.h"
|
#include "FollowerReference.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class PointMovementGenerator
|
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, PointMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
|
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
|
||||||
@@ -46,8 +45,7 @@ class PointMovementGenerator
|
|||||||
float speed;
|
float speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssistanceMovementGenerator
|
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
|
||||||
: public PointMovementGenerator<Creature>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
AssistanceMovementGenerator(float _x, float _y, float _z) :
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
void RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
||||||
RandomMovementGenerator<Creature>::Reset(Creature &creature)
|
|
||||||
{
|
{
|
||||||
Initialize(creature);
|
Initialize(creature);
|
||||||
}
|
}
|
||||||
@@ -141,8 +140,7 @@ void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
bool
|
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
||||||
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
|
|
||||||
{
|
{
|
||||||
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class RandomMovementGenerator
|
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
||||||
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
|
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ class TargetedMovementGeneratorBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class T, typename D>
|
template<class T, typename D>
|
||||||
class TargetedMovementGeneratorMedium
|
class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
||||||
: public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
|
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
|
||||||
|
|||||||
@@ -58,8 +58,7 @@ template<class T>
|
|||||||
class WaypointMovementGenerator;
|
class WaypointMovementGenerator;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
class WaypointMovementGenerator<Creature>
|
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||||
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
|
||||||
public PathMovementBase<Creature, WaypointPath const*>
|
public PathMovementBase<Creature, WaypointPath const*>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -110,8 +109,7 @@ public PathMovementBase<Creature, WaypointPath const*>
|
|||||||
/** FlightPathMovementGenerator generates movement of the player for the paths
|
/** FlightPathMovementGenerator generates movement of the player for the paths
|
||||||
* and hence generates ground and activities for the player.
|
* and hence generates ground and activities for the player.
|
||||||
*/
|
*/
|
||||||
class FlightPathMovementGenerator
|
class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
||||||
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
|
|
||||||
public PathMovementBase<Player, TaxiPathNodeList const*>
|
public PathMovementBase<Player, TaxiPathNodeList const*>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user