Core: Corrected NULL usage, it should only be used with pointers, not integers

This commit is contained in:
Shauren
2011-04-23 15:53:48 +02:00
parent a2a751b9d6
commit 8898db8b27
56 changed files with 216 additions and 217 deletions
@@ -72,7 +72,7 @@ void SmartScript::OnReset()
(*i).runOnce = false;
}
ProcessEventsFor(SMART_EVENT_RESET);
mLastInvoker = NULL;
mLastInvoker = 0;
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
@@ -152,7 +152,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
mLastTextID = e.action.talk.textGroupID;
mTextTimer = e.action.talk.duration;
mTextGUID = IsPlayer(GetLastInvoker()) ? GetLastInvoker()->GetGUID() : NULL;//invoker, used for $vars in texts
mTextGUID = IsPlayer(GetLastInvoker()) ? GetLastInvoker()->GetGUID() : 0;//invoker, used for $vars in texts
mUseTextTimer = true;
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u",
@@ -167,11 +167,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsCreature((*itr)))
sCreatureTextMgr->SendChat((*itr)->ToCreature(), uint8(e.action.talk.textGroupID), IsPlayer(GetLastInvoker())? GetLastInvoker()->GetGUID() : NULL);
sCreatureTextMgr->SendChat((*itr)->ToCreature(), uint8(e.action.talk.textGroupID), IsPlayer(GetLastInvoker())? GetLastInvoker()->GetGUID() : 0);
else if (IsPlayer((*itr)))
{
Unit* templastInvoker = GetLastInvoker();
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : NULL, CHAT_TYPE_END, LANG_ADDON, TEXT_RANGE_NORMAL, NULL, TEAM_OTHER, false, (*itr)->ToPlayer());
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_TYPE_END, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer());
}
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
(*itr)->GetName(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
@@ -207,7 +207,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (IsCreature((*itr)))
{
sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_TYPE_SAY, 0, TextRange(e.action.sound.range), Team(NULL), false);
sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_TYPE_SAY, 0, TextRange(e.action.sound.range), Team(0), false);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: source: %s (GuidLow: %u), sound: %u, range: %u",
(*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
}
@@ -369,7 +369,7 @@ void BattlegroundSA::Update(uint32 diff)
RoundScores[1].winner = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
if (RoundScores[0].time == RoundScores[1].time)
EndBattleground(NULL);
EndBattleground(0);
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleground(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
@@ -829,7 +829,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
}
if (RoundScores[0].time == RoundScores[1].time)
EndBattleground(NULL);
EndBattleground(0);
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleground(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
@@ -73,7 +73,7 @@ void BattlegroundWS::Update(uint32 diff)
if (GetTeamScore(ALLIANCE) == 0)
{
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
EndBattleground(NULL);
EndBattleground(0);
else // Horde has more points and thus wins
EndBattleground(HORDE);
}
+2 -2
View File
@@ -1293,8 +1293,8 @@ void Pet::_SaveAuras(SQLTransaction& trans)
}
else
{
baseDamage[i] = NULL;
damage[i] = NULL;
baseDamage[i] = 0;
damage[i] = 0;
}
}
+2 -2
View File
@@ -3703,8 +3703,8 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
}
else
{
baseDamage[i] = NULL;
damage[i] = NULL;
baseDamage[i] = 0;
damage[i] = 0;
}
}
+3 -3
View File
@@ -1645,15 +1645,15 @@ class Unit : public WorldObject
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(Aura * aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
inline void RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except = NULL, bool negative = true, bool positive = true);
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = NULL);
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0);
void RemoveAurasWithAttribute(uint32 flags);
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
+1 -1
View File
@@ -294,7 +294,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), seat->second.passenger))
passenger->ExitVehicle();
else
seat->second.passenger = NULL;
seat->second.passenger = 0;
}
ASSERT(!seat->second.passenger);
+1 -1
View File
@@ -79,7 +79,7 @@ enum VehicleSpells
struct VehicleSeat
{
explicit VehicleSeat(VehicleSeatEntry const *_seatInfo) : seatInfo(_seatInfo), passenger(NULL) {}
explicit VehicleSeat(VehicleSeatEntry const *_seatInfo) : seatInfo(_seatInfo), passenger(0) {}
VehicleSeatEntry const *seatInfo;
uint64 passenger;
};
+1 -1
View File
@@ -4184,7 +4184,7 @@ void ObjectMgr::LoadQuests()
// 142 143
"StartScript, CompleteScript"
" FROM quest_template");
if (result == NULL)
if (!result)
{
sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
sLog->outString();
+2 -2
View File
@@ -328,7 +328,7 @@ void MapManager::UnloadAll()
uint32 MapManager::GetNumInstances()
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, 0);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
@@ -345,7 +345,7 @@ uint32 MapManager::GetNumInstances()
uint32 MapManager::GetNumPlayersInInstances()
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, 0);
uint32 ret = 0;
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
+1 -1
View File
@@ -702,7 +702,7 @@ void WorldSession::SaveTutorialsData(SQLTransaction &trans)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_GET_HAS_TUTORIALS);
stmt->setUInt32(0, GetAccountId());
bool hasTutorials = (CharacterDatabase.Query(stmt) != NULL);
bool hasTutorials = CharacterDatabase.Query(stmt).null();
// Modify data in DB
stmt = CharacterDatabase.GetPreparedStatement(hasTutorials ? CHAR_SET_TUTORIALS : CHAR_ADD_TUTORIALS);
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
@@ -4525,9 +4525,8 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const * aurApp, uint
Unit * target = aurApp->GetTarget();
if ((apply) && GetSpellProto()->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
target->RemoveAurasByType(AuraType(GetMiscValue()), NULL , GetBase());
}
target->RemoveAurasByType(AuraType(GetMiscValue()), 0 , GetBase());
// stop handling the effect if it was removed by linked event
if (apply && aurApp->GetRemoveMode())
return;
+1 -1
View File
@@ -1371,7 +1371,7 @@ class SpellMgr
SpellRequiredMap::const_iterator itr = mSpellReq.find(spell_id);
if (itr == mSpellReq.end())
return NULL;
return 0;
return itr->second;
}
+2 -2
View File
@@ -348,7 +348,7 @@ int32 SpellScript::GetHitDamage()
if (!IsInHitPhase())
{
sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called while spell not in hit phase!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
return 0;
}
return m_spell->m_damage;
}
@@ -368,7 +368,7 @@ int32 SpellScript::GetHitHeal()
if (!IsInHitPhase())
{
sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called while spell not in hit phase!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
return 0;
}
return m_spell->m_healing;
}