aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/bnetserver/Main.cpp19
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp3
-rw-r--r--src/server/game/Server/Packets/TicketPackets.cpp5
-rw-r--r--src/server/game/Spells/Spell.cpp2
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp2
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp56
-rw-r--r--src/server/worldserver/Main.cpp22
8 files changed, 24 insertions, 89 deletions
diff --git a/src/server/bnetserver/Main.cpp b/src/server/bnetserver/Main.cpp
index ab7c91512e2..5f4f63287e5 100644
--- a/src/server/bnetserver/Main.cpp
+++ b/src/server/bnetserver/Main.cpp
@@ -61,7 +61,7 @@ boost::asio::deadline_timer _dbPingTimer(_ioService);
uint32 _dbPingInterval;
LoginDatabaseWorkerPool LoginDatabase;
-int mainImpl(int argc, char** argv)
+int main(int argc, char** argv)
{
std::string configFile = _TRINITY_BNET_CONFIG;
auto vm = GetConsoleArguments(argc, argv, configFile);
@@ -156,23 +156,6 @@ int mainImpl(int argc, char** argv)
return 0;
}
-int main(int argc, char** argv)
-{
- try
- {
- return mainImpl(argc, argv);
- }
- catch (std::exception& ex)
- {
- std::cerr << "Top-level exception caught:" << ex.what() << "\n";
-
-#ifndef NDEBUG // rethrow exception for the debugger
- throw;
-#else
- return 1;
-#endif
- }
-}
/// Initialize connection to the database
bool StartDB()
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 108e5cedd09..b80e861c4df 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -3199,7 +3199,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();
}
@@ -3230,7 +3230,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();
}
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 735328a0f1f..dd996ee0f50 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -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() { }
diff --git a/src/server/game/Server/Packets/TicketPackets.cpp b/src/server/game/Server/Packets/TicketPackets.cpp
index c33511a0fc4..70ef53551da 100644
--- a/src/server/game/Server/Packets/TicketPackets.cpp
+++ b/src/server/game/Server/Packets/TicketPackets.cpp
@@ -203,10 +203,9 @@ WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine::Suppo
Text = data.ReadString(textLength);
}
-WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine::SupportTicketChatLine(uint32 timestamp, std::string const& text)
+WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine::SupportTicketChatLine(uint32 timestamp, std::string const& text) :
+ Timestamp(timestamp), Text(text)
{
- Timestamp = timestamp;
- Text = text;
}
ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Ticket::SupportTicketSubmitComplaint::SupportTicketChatLine& line)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index a307b60f76b..919f11a5db4 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -7229,7 +7229,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)
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index c5e2deaac24..8105f7de5ff 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -1301,7 +1301,7 @@ class spell_mage_ring_of_frost : public SpellScriptLoader
GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->GetEffect(EFFECT_0)->MiscValue);
// Get the last summoned RoF, save it and despawn older ones
- for (std::list<TempSummon*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
+ for (std::list<TempSummon*>::iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
{
TempSummon* summon = (*itr);
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index d8b63150e3c..9a7ebc9625c 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -392,9 +392,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
+ int32 const ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
amount += ownerBonus;
_tempBonus = ownerBonus;
@@ -445,8 +443,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetArmor(), 35);
+ int32 const ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
}
@@ -457,8 +454,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
}
@@ -504,8 +500,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
}
@@ -516,8 +511,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
}
@@ -528,8 +522,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
}
@@ -570,8 +563,7 @@ public:
if (pet->IsPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = 0.0f;
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
}
@@ -906,7 +898,6 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float mod = 0.45f;
- float ownerBonus = 0.0f;
PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
if (itr == pet->ToPet()->m_spells.end())
@@ -918,8 +909,7 @@ public:
AddPct(mod, spellInfo->GetEffect(EFFECT_0)->CalcValue());
}
- ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
-
+ int32 const ownerBonus = owner->GetStat(STAT_STAMINA) * mod;
amount += ownerBonus;
}
}
@@ -1043,10 +1033,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
-
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
}
@@ -1062,10 +1049,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
-
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
}
@@ -1081,10 +1065,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
-
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
}
@@ -1130,10 +1111,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
-
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
}
@@ -1149,10 +1127,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
-
+ int32 const ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
}
@@ -1168,10 +1143,7 @@ public:
if (!owner)
return;
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePct(owner->GetArmor(), 35);
-
+ int32 const ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
}
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 362b5b05168..15d08a903b9 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -97,7 +97,8 @@ void ShutdownThreadPool(std::vector<std::thread>& threadPool);
bool LoadRealmInfo();
variables_map GetConsoleArguments(int argc, char** argv, std::string& cfg_file, std::string& cfg_service);
-int mainImpl(int argc, char** argv)
+/// Launch the Trinity server
+extern int main(int argc, char** argv)
{
std::string configFile = _TRINITY_CORE_CONFIG;
std::string configService;
@@ -305,25 +306,6 @@ int mainImpl(int argc, char** argv)
return World::GetExitCode();
}
-/// Launch the Trinity server
-extern int main(int argc, char** argv)
-{
- try
- {
- return mainImpl(argc, argv);
- }
- catch (std::exception& ex)
- {
- std::cerr << "Top-level exception caught:" << ex.what() << "\n";
-
-#ifndef NDEBUG // rethrow exception for the debugger
- throw;
-#else
- return 1;
-#endif
- }
-}
-
void ShutdownCLIThread(std::thread* cliThread)
{
if (cliThread != nullptr)