aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2012-08-30 22:44:03 +0100
committerNay <dnpd.dd@gmail.com>2012-08-30 22:44:03 +0100
commitabbb896cfb73017cf1c313d597984a9ce0a9dcab (patch)
tree58cd6165976448c3cdec18c4e4c6381c6bfba936 /src/server/scripts/EasternKingdoms
parent5f1977cb1d690d2e60a1f5355244ec472e014278 (diff)
Core: Fix many "errors"/warnings and coding style (2)
Scripts; also reverted a change to AuthSocket Errors were found using Cppcheck, open-source static analysis tool
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp10
6 files changed, 26 insertions, 34 deletions
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index 204fbe5223b..25c3f2e41e3 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -243,11 +243,9 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit;
if ((*i) && (*i)->getSource())
{
- unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Cast affliction
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index 06c1243645c..533a1aac2f0 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -201,12 +201,11 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- Temp->DisappearAndDie();
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ temp->DisappearAndDie();
}
}
}
@@ -215,14 +214,13 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
{
- Temp->AI()->AttackStart(me->getVictim());
- DoZoneInCombat(Temp);
+ temp->AI()->AttackStart(me->getVictim());
+ DoZoneInCombat(temp);
} else
EnterEvadeMode();
}
@@ -250,13 +248,12 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Unit::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- if (!Temp->getVictim())
- Temp->AI()->AttackStart(me->getVictim());
+ Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ if (!temp->getVictim())
+ temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index d4c037d45c3..b405f9eba85 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -240,7 +240,6 @@ public:
return;
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
- Creature* summon = NULL;
if (!pArchmage || !pArchmage->isAlive())
return;
@@ -252,7 +251,8 @@ public:
switch (uiPhase)
{
case 1:
- summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
+ {
+ Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
@@ -260,13 +260,16 @@ public:
uiTimer = 2000;
uiPhase = 2;
break;
+ }
case 2:
+ {
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
uiPhase = 0;
break;
+ }
}
} else uiTimer -= uiDiff;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 1009d3e0a0a..8fb3dd55077 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -315,14 +315,12 @@ class boss_zuljin : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Temp = NULL;
if (SpiritGUID[i])
{
- Temp = Unit::GetUnit(*me, SpiritGUID[i]);
- if (Temp)
+ if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
{
- Temp->SetVisible(false);
- Temp->setDeathState(DEAD);
+ temp->SetVisible(false);
+ temp->setDeathState(DEAD);
}
}
SpiritGUID[i] = 0;
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index 870cb29c28d..c52e69787d4 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -230,13 +230,11 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
- Player* player = NULL;
Unit* target = NULL;
if (PlayerGUID)
{
- player = Unit::GetPlayer(*me, PlayerGUID);
- if (player)
- target = RAND((Unit*)me, (Unit*)player);
+ if (Unit* player = Unit::GetPlayer(*me, PlayerGUID)->ToUnit())
+ target = RAND((Unit*)me, player);
} else
target = me;
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index fac8fb51c2d..34e6e7c9ddf 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -60,12 +60,12 @@ public:
{
npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { }
- bool m_bFriendSummoned;
+ bool IsFriendSummoned;
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- m_bFriendSummoned = false;
+ IsFriendSummoned = false;
}
void WaypointReached(uint32 waypointId)
@@ -83,14 +83,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- Player* player = GetPlayerForEscort();
-
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && player)
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort())
{
for (uint8 i = 0; i < 3; ++i)
DoCast(me, SPELL_CALL_FRIENDS, true);
- m_bFriendSummoned = true;
+ IsFriendSummoned = true;
}
}