Core/Cleanup:

Mostly if(.. -> if (.. and for(.. -> for (..
but also some miscellaneous cleanup
This commit is contained in:
kaelima
2012-04-08 23:59:52 +02:00
parent 38d5fbac0e
commit 49e24e2dfb
23 changed files with 63 additions and 84 deletions
+4 -8
View File
@@ -27,8 +27,7 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
int
TotemAI::Permissible(const Creature* creature)
int TotemAI::Permissible(Creature const* creature)
{
if (creature->isTotem())
return PERMIT_BASE_PROACTIVE;
@@ -41,8 +40,7 @@ TotemAI::TotemAI(Creature* c) : CreatureAI(c), i_victimGuid(0)
ASSERT(c->isTotem());
}
void
TotemAI::MoveInLineOfSight(Unit*)
void TotemAI::MoveInLineOfSight(Unit* /*who*/)
{
}
@@ -51,8 +49,7 @@ void TotemAI::EnterEvadeMode()
me->CombatStop(true);
}
void
TotemAI::UpdateAI(const uint32 /*diff*/)
void TotemAI::UpdateAI(uint32 const /*diff*/)
{
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
return;
@@ -98,8 +95,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
i_victimGuid = 0;
}
void
TotemAI::AttackStart(Unit*)
void TotemAI::AttackStart(Unit* /*victim*/)
{
// Sentry totem sends ping on attack
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
+4 -4
View File
@@ -31,12 +31,12 @@ class TotemAI : public CreatureAI
explicit TotemAI(Creature* c);
void MoveInLineOfSight(Unit*);
void AttackStart(Unit*);
void MoveInLineOfSight(Unit* who);
void AttackStart(Unit* victim);
void EnterEvadeMode();
void UpdateAI(const uint32);
static int Permissible(const Creature*);
void UpdateAI(uint32 const diff);
static int Permissible(Creature const* creature);
private:
uint64 i_victimGuid;
+2 -2
View File
@@ -82,7 +82,7 @@ namespace FactorySelector
{
const CreatureAICreator* factory = iter->second;
const SelectableAI* p = dynamic_cast<const SelectableAI*>(factory);
ASSERT(p != NULL);
ASSERT(p);
int val = p->Permit(creature);
if (val > best_val)
{
@@ -102,7 +102,7 @@ namespace FactorySelector
MovementGenerator* selectMovementGenerator(Creature* creature)
{
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
ASSERT(creature->GetCreatureTemplate() != NULL);
ASSERT(creature->GetCreatureTemplate());
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
/* if (mv_factory == NULL)
+2 -1
View File
@@ -1494,7 +1494,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
}
else
{
if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
if (ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
bonusPct += (*itr)->GetAmount();
}
}
@@ -1504,6 +1504,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
maxArmorPen = float(400 + 85 * victim->getLevel());
else
maxArmorPen = 400 + 85 * victim->getLevel() + 4.5f * 85 * (victim->getLevel() - 59);
// Cap armor penetration to this number
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
// Figure out how much armor do we ignore
+7 -7
View File
@@ -96,26 +96,26 @@ void MapManager::checkAndCorrectGridStatesArray()
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);
const MapEntry* entry = sMapStore.LookupEntry(id);
if (entry && entry->Instanceable())
{
m = new MapInstanced(id, i_gridCleanUpDelay);
map = new MapInstanced(id, i_gridCleanUpDelay);
}
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);
return m;
ASSERT(map);
return map;
}
Map* MapManager::FindBaseNonInstanceMap(uint32 mapId) const
@@ -410,7 +410,7 @@ enum SpellAttr3
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_UNK2 = 0x00000004, // 2
SPELL_ATTR4_UNK3 = 0x00000008, // 3
@@ -28,8 +28,7 @@
#define MAX_QUIET_DISTANCE 43.0f
template<class T>
void
FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
void FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
{
if (!&owner)
return;
@@ -53,8 +52,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
}
template<class T>
bool
FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
{
if (!&owner)
return false;
@@ -187,8 +185,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
}
template<class T>
bool
FleeingMovementGenerator<T>::_setMoveData(T &owner)
bool FleeingMovementGenerator<T>::_setMoveData(T &owner)
{
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>
void
FleeingMovementGenerator<T>::Initialize(T &owner)
void FleeingMovementGenerator<T>::Initialize(T &owner)
{
if (!&owner)
return;
@@ -312,8 +308,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
}
template<>
void
FleeingMovementGenerator<Creature>::_Init(Creature &owner)
void FleeingMovementGenerator<Creature>::_Init(Creature &owner)
{
if (!&owner)
return;
@@ -324,8 +319,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
}
template<>
void
FleeingMovementGenerator<Player>::_Init(Player &)
void FleeingMovementGenerator<Player>::_Init(Player &)
{
is_water_ok = true;
is_land_ok = true;
@@ -354,8 +348,7 @@ void FleeingMovementGenerator<T>::Reset(T &owner)
}
template<class T>
bool
FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
{
if (!&owner || !owner.isAlive())
return false;
@@ -22,8 +22,7 @@
#include "MovementGenerator.h"
template<class T>
class FleeingMovementGenerator
: public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovementGenerator<T> >
{
public:
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
@@ -55,8 +54,7 @@ class FleeingMovementGenerator
TimeTracker i_nextCheckTime;
};
class TimedFleeingMovementGenerator
: public FleeingMovementGenerator<Creature>
class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
{
public:
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
@@ -27,8 +27,7 @@ template < class T >
class HomeMovementGenerator;
template <>
class HomeMovementGenerator<Creature>
: public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, HomeMovementGenerator<Creature> >
{
public:
@@ -23,8 +23,7 @@
#include "FollowerReference.h"
template<class T>
class PointMovementGenerator
: public MovementGeneratorMedium< T, PointMovementGenerator<T> >
class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementGenerator<T> >
{
public:
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
@@ -46,8 +45,7 @@ class PointMovementGenerator
float speed;
};
class AssistanceMovementGenerator
: public PointMovementGenerator<Creature>
class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
{
public:
AssistanceMovementGenerator(float _x, float _y, float _z) :
@@ -127,8 +127,7 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
}
template<>
void
RandomMovementGenerator<Creature>::Reset(Creature &creature)
void RandomMovementGenerator<Creature>::Reset(Creature &creature)
{
Initialize(creature);
}
@@ -141,8 +140,7 @@ void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
}
template<>
bool
RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
{
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
{
@@ -22,8 +22,7 @@
#include "MovementGenerator.h"
template<class T>
class RandomMovementGenerator
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
{
public:
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
@@ -34,8 +34,7 @@ class TargetedMovementGeneratorBase
};
template<class T, typename D>
class TargetedMovementGeneratorMedium
: public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >, public TargetedMovementGeneratorBase
{
protected:
TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) :
@@ -58,8 +58,7 @@ template<class T>
class WaypointMovementGenerator;
template<>
class WaypointMovementGenerator<Creature>
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
public PathMovementBase<Creature, WaypointPath const*>
{
public:
@@ -110,8 +109,7 @@ public PathMovementBase<Creature, WaypointPath const*>
/** FlightPathMovementGenerator generates movement of the player for the paths
* and hence generates ground and activities for the player.
*/
class FlightPathMovementGenerator
: public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >,
public PathMovementBase<Player, TaxiPathNodeList const*>
{
public: