aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
authorSpp <none@none>2010-12-06 02:07:53 +0100
committerSpp <none@none>2010-12-06 02:07:53 +0100
commit408fce1de69249b82cc042cb31f3fd16983c7e81 (patch)
treef4b99f386821e70f155d9aa61b70cfb1f2d3d825 /src/server/scripts/World
parente226c4ac344d06c7abbd6f04725ced2b33606349 (diff)
Core: Some optimizations
- Declare some functions const - Fix some mem leak - Fix some resource leak - Remove unused variables and functions - Remove duplicate functions - Reduce the scope of some variables - Remove unused file --HG-- branch : trunk
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/npcs_special.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 412626d29c8..66b8e400a71 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -820,9 +820,6 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
{
if (SummonPatient_Timer <= diff)
{
- Creature* Patient = NULL;
- Location* Point = NULL;
-
if (Coordinates.empty())
return;
@@ -838,22 +835,21 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff)
return;
}
- Point = *itr;
-
- Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
-
- if (Patient)
+ if (Location* Point = *itr)
{
- //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
- Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
+ if (Creature* Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
+ {
+ //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND)
+ Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
- Patients.push_back(Patient->GetGUID());
- CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID();
+ Patients.push_back(Patient->GetGUID());
+ CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID();
- if (Point)
- CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point;
+ if (Point)
+ CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point;
- Coordinates.erase(itr);
+ Coordinates.erase(itr);
+ }
}
SummonPatient_Timer = 10000;
++SummonPatientCount;