Skip to content

Commit 05fa048

Browse files
committed
[2132] Remove now unneeded ObjectGuid.IsEmpty() calls
1 parent 63fae55 commit 05fa048

11 files changed

Lines changed: 28 additions & 28 deletions

File tree

base/escort_ai.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho)
170170

171171
void npc_escortAI::JustDied(Unit* pKiller)
172172
{
173-
if (!HasEscortState(STATE_ESCORT_ESCORTING) || m_playerGuid.IsEmpty() || !m_pQuestForEscort)
173+
if (!HasEscortState(STATE_ESCORT_ESCORTING) || !m_playerGuid || !m_pQuestForEscort)
174174
return;
175175

176176
if (Player* pPlayer = GetPlayerForEscort())
@@ -316,7 +316,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
316316
}
317317

318318
//Check if player or any member of his group is within range
319-
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_playerGuid.IsEmpty() && !m_creature->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
319+
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_playerGuid && !m_creature->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
320320
{
321321
if (m_uiPlayerCheckTimer < uiDiff)
322322
{

base/follower_ai.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void FollowerAI::MoveInLineOfSight(Unit* pWho)
121121

122122
void FollowerAI::JustDied(Unit* pKiller)
123123
{
124-
if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || m_leaderGuid.IsEmpty() || !m_pQuestForFollow)
124+
if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_leaderGuid || !m_pQuestForFollow)
125125
return;
126126

127127
//TODO: need a better check for quests with time limit.

include/sc_instance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//Optional uiWithRestoreTime. If not defined, autoCloseTime will be used (if not 0 by default in *_template)
88
void ScriptedInstance::DoUseDoorOrButton(ObjectGuid guid, uint32 uiWithRestoreTime, bool bUseAlternativeState)
99
{
10-
if (guid.IsEmpty())
10+
if (!guid)
1111
return;
1212

1313
if (GameObject* pGo = instance->GetGameObject(guid))
@@ -26,7 +26,7 @@ void ScriptedInstance::DoUseDoorOrButton(ObjectGuid guid, uint32 uiWithRestoreTi
2626

2727
void ScriptedInstance::DoRespawnGameObject(ObjectGuid guid, uint32 uiTimeToDespawn)
2828
{
29-
if (guid.IsEmpty())
29+
if (!guid)
3030
return;
3131

3232
if (GameObject* pGo = instance->GetGameObject(guid))

scripts/eastern_kingdoms/eversong_woods.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct MANGOS_DLL_DECL npc_kelerun_bloodmournAI : public ScriptedAI
147147
{
148148
if (m_uiTimeOutTimer && m_uiTimeOutTimer < uiDiff)
149149
{
150-
if (m_playerGuid.IsEmpty())
150+
if (!m_playerGuid)
151151
{
152152
//player are expected to use GO within a minute, if not, event will fail.
153153
Reset();

scripts/eastern_kingdoms/ghostlands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct MANGOS_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
118118
{
119119
if (HasEscortState(STATE_ESCORT_ESCORTING))
120120
{
121-
if (m_heliosGuid.IsEmpty() && pUnit->GetEntry() == NPC_CAPTAIN_HELIOS)
121+
if (!m_heliosGuid && pUnit->GetEntry() == NPC_CAPTAIN_HELIOS)
122122
{
123123
if (m_creature->IsWithinDistInMap(pUnit, 30.0f))
124124
m_heliosGuid = pUnit->GetObjectGuid();

scripts/eastern_kingdoms/scarlet_enclave/ebon_hold.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct MANGOS_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI
162162

163163
void MoveInLineOfSight(Unit* pWho)
164164
{
165-
if (!m_playerGuid.IsEmpty() || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(m_creature, INTERACTION_DISTANCE))
165+
if (m_playerGuid || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(m_creature, INTERACTION_DISTANCE))
166166
return;
167167

168168
if (MeetQuestCondition((Player*)pWho))
@@ -171,7 +171,7 @@ struct MANGOS_DLL_DECL npc_a_special_surpriseAI : public ScriptedAI
171171

172172
void UpdateAI(const uint32 uiDiff)
173173
{
174-
if (!m_playerGuid.IsEmpty() && !m_creature->getVictim() && m_creature->isAlive())
174+
if (m_playerGuid && !m_creature->getVictim() && m_creature->isAlive())
175175
{
176176
if (m_uiExecuteSpeech_Timer < uiDiff)
177177
{
@@ -995,7 +995,7 @@ struct MANGOS_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
995995

996996
Creature* GetAnchor()
997997
{
998-
if (!m_myAnchorGuid.IsEmpty())
998+
if (m_myAnchorGuid)
999999
return m_creature->GetMap()->GetCreature(m_myAnchorGuid);
10001000
else
10011001
return GetClosestCreatureWithEntry(m_creature, NPC_ANCHOR, INTERACTION_DISTANCE*2);

scripts/eastern_kingdoms/swamp_of_sorrows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct MANGOS_DLL_DECL npc_galen_goodwardAI : public npc_escortAI
7272
case 0:
7373
{
7474
GameObject* pCage = NULL;
75-
if (!m_galensCageGuid.IsEmpty())
75+
if (m_galensCageGuid)
7676
pCage = m_creature->GetMap()->GetGameObject(m_galensCageGuid);
7777
else
7878
pCage = GetClosestGameObjectWithEntry(m_creature, GO_GALENS_CAGE, INTERACTION_DISTANCE);

scripts/northrend/borean_tundra.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -453,37 +453,37 @@ struct MANGOS_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
453453
{
454454
npc_sinkhole_kill_creditAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
455455

456-
ObjectGuid m_uiCartGUID;
457-
ObjectGuid m_uiWormGUID;
456+
ObjectGuid m_cartGuid;
457+
ObjectGuid m_wormGuid;
458458
uint32 m_uiCartTimer;
459459
uint32 m_uiCartPhase;
460460

461461
void Reset()
462462
{
463-
m_uiCartGUID.Clear();
464-
m_uiWormGUID.Clear();
463+
m_cartGuid.Clear();
464+
m_wormGuid.Clear();
465465
m_uiCartTimer = 2000;
466466
m_uiCartPhase = 0;
467467
}
468468

469469
void JustSummoned(Creature* pSummoned)
470470
{
471-
m_uiWormGUID = pSummoned->GetObjectGuid();
471+
m_wormGuid = pSummoned->GetObjectGuid();
472472
}
473473

474474
void JustSummoned(GameObject* pGo)
475475
{
476476
// Go is not really needed, but ok to use as a check point so only one "event" can be processed at a time
477-
if (!m_uiCartGUID.IsEmpty())
477+
if (m_cartGuid)
478478
return;
479479

480480
// Expecting summoned from mangos dummy effect 46797
481-
m_uiCartGUID = pGo->GetObjectGuid();
481+
m_cartGuid = pGo->GetObjectGuid();
482482
}
483483

484484
void UpdateAI(const uint32 uiDiff)
485485
{
486-
if (!m_uiCartGUID.IsEmpty())
486+
if (m_cartGuid)
487487
{
488488
if (m_uiCartTimer <= uiDiff)
489489
{
@@ -504,15 +504,15 @@ struct MANGOS_DLL_DECL npc_sinkhole_kill_creditAI : public ScriptedAI
504504
m_uiCartTimer = 2000;
505505
break;
506506
case 3:
507-
if (Creature* pWorm = m_creature->GetMap()->GetCreature(m_uiWormGUID))
507+
if (Creature* pWorm = m_creature->GetMap()->GetCreature(m_wormGuid))
508508
{
509509
pWorm->SetDeathState(JUST_DIED);
510510
pWorm->SetHealth(0);
511511
}
512512
m_uiCartTimer = 10000;
513513
break;
514514
case 4:
515-
if (Creature* pWorm = m_creature->GetMap()->GetCreature(m_uiWormGUID))
515+
if (Creature* pWorm = m_creature->GetMap()->GetCreature(m_wormGuid))
516516
pWorm->RemoveCorpse();
517517

518518
Reset();

scripts/outland/shadowmoon_valley.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ struct MANGOS_DLL_DECL npc_dragonmaw_peonAI : public ScriptedAI
331331
bool SetPlayerTarget(ObjectGuid playerGuid)
332332
{
333333
// Check if event already started
334-
if (!m_playerGuid.IsEmpty())
334+
if (m_playerGuid)
335335
return false;
336336

337337
m_playerGuid = playerGuid;
@@ -1225,7 +1225,7 @@ struct MANGOS_DLL_DECL npc_lord_illidan_stormrageAI : public Scripted_NoMovement
12251225
// increment mob count
12261226
++m_uiMobCount;
12271227

1228-
if (m_playerGuid.IsEmpty())
1228+
if (!m_playerGuid)
12291229
return;
12301230

12311231
if (pSummoned->GetEntry() == NPC_TORLOTH_THE_MAGNIFICENT)
@@ -1320,7 +1320,7 @@ struct MANGOS_DLL_DECL npc_lord_illidan_stormrageAI : public Scripted_NoMovement
13201320

13211321
void UpdateAI(const uint32 uiDiff)
13221322
{
1323-
if (m_playerGuid.IsEmpty() || !m_bEventStarted)
1323+
if (!m_playerGuid || !m_bEventStarted)
13241324
return;
13251325

13261326
if (!m_uiMobCount && m_uiWaveCount < 4)

scripts/world/npcs_special.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ struct MANGOS_DLL_DECL npc_air_force_botsAI : public ScriptedAI
178178
if (!pPlayerTarget)
179179
return;
180180

181-
Creature* pLastSpawnedGuard = m_spawnedGuid.IsEmpty() ? NULL : GetSummonedGuard();
181+
Creature* pLastSpawnedGuard = m_spawnedGuid ? GetSummonedGuard() : NULL;
182182

183183
// prevent calling GetCreature at next MoveInLineOfSight call - speedup
184184
if (!pLastSpawnedGuard)
@@ -560,7 +560,7 @@ struct MANGOS_DLL_DECL npc_injured_patientAI : public ScriptedAI
560560
{
561561
if ((((Player*)caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (((Player*)caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))
562562
{
563-
if (!m_doctorGuid.IsEmpty())
563+
if (m_doctorGuid)
564564
{
565565
if (Creature* pDoctor = m_creature->GetMap()->GetCreature(m_doctorGuid))
566566
{
@@ -618,7 +618,7 @@ struct MANGOS_DLL_DECL npc_injured_patientAI : public ScriptedAI
618618
m_creature->SetDeathState(JUST_DIED);
619619
m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
620620

621-
if (!m_doctorGuid.IsEmpty())
621+
if (m_doctorGuid)
622622
{
623623
if (Creature* pDoctor = m_creature->GetMap()->GetCreature(m_doctorGuid))
624624
{

0 commit comments

Comments
 (0)