mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Core/Game: Fix some issues detected by static analysis.
* Possible inefficient checking for 'list' emptiness.
* Variable '_scheduledScripts' is assigned in constructor body.
Consider performing initialization in initialization list.
* Variable 'Text' is assigned in constructor body.
Consider performing initialization in initialization list.
* Possible inefficient checking for 'm_loadedScripts' emptiness.
(cherry picked from commit 9a61049f88)
Conflicts:
src/server/game/Server/Packets/TicketPackets.cpp
This commit is contained in:
@@ -3167,7 +3167,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
std::list<Creature*> list;
|
||||
me->GetCreatureListWithEntryInGrid(list, e.event.distance.entry, (float)e.event.distance.dist);
|
||||
|
||||
if (list.size() > 0)
|
||||
if (!list.empty())
|
||||
creature = list.front();
|
||||
}
|
||||
|
||||
@@ -3198,7 +3198,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
std::list<GameObject*> list;
|
||||
me->GetGameObjectListWithEntryInGrid(list, e.event.distance.entry, (float)e.event.distance.dist);
|
||||
|
||||
if (list.size() > 0)
|
||||
if (!list.empty())
|
||||
gameobject = list.front();
|
||||
}
|
||||
|
||||
|
||||
@@ -182,9 +182,8 @@ struct TSpellSummary
|
||||
uint8 Effects; // set of enum SelectEffect
|
||||
} *SpellSummary;
|
||||
|
||||
ScriptMgr::ScriptMgr() : _scriptCount(0)
|
||||
ScriptMgr::ScriptMgr() : _scriptCount(0), _scheduledScripts(0)
|
||||
{
|
||||
_scheduledScripts = 0;
|
||||
}
|
||||
|
||||
ScriptMgr::~ScriptMgr() { }
|
||||
|
||||
@@ -7140,7 +7140,7 @@ void Spell::CallScriptDestinationTargetSelectHandlers(SpellDestination& target,
|
||||
bool Spell::CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck)
|
||||
{
|
||||
// Skip if there are not any script
|
||||
if (!m_loadedScripts.size())
|
||||
if (m_loadedScripts.empty())
|
||||
return true;
|
||||
|
||||
for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
|
||||
|
||||
Reference in New Issue
Block a user