aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/authserver/Main.cpp2
-rw-r--r--src/server/authserver/Realms/RealmList.h2
-rw-r--r--src/server/authserver/Server/AuthSocket.cpp23
-rw-r--r--src/server/authserver/Server/RealmSocket.cpp6
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp2
-rw-r--r--src/server/game/Battlefield/Battlefield.h2
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp7
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h6
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp69
-rw-r--r--src/server/game/Calendar/CalendarMgr.h6
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp14
-rw-r--r--src/server/game/Entities/Item/Item.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp6
-rw-r--r--src/server/game/Globals/ObjectMgr.h4
-rw-r--r--src/server/game/Guilds/Guild.cpp2
-rw-r--r--src/server/game/Guilds/Guild.h2
-rw-r--r--src/server/game/Loot/LootMgr.cpp2
-rw-r--r--src/server/game/Loot/LootMgr.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp7
-rw-r--r--src/server/scripts/Commands/cs_account.cpp4
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp2
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp4
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp3
-rw-r--r--src/server/shared/Utilities/Util.h8
27 files changed, 97 insertions, 96 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index 9a6cc89fdd4..b16e86a7f9f 100644
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -298,7 +298,7 @@ bool StartDB()
}
// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
- if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads)))
+ if (!LoginDatabase.Open(dbstring, uint8(worker_threads), uint8(synch_threads)))
{
TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot connect to database");
return false;
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index 68e6524c334..d59990135f2 100644
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -66,7 +66,7 @@ public:
void UpdateIfNeed();
- void AddRealm(Realm NewRealm) {m_realms[NewRealm.name] = NewRealm;}
+ void AddRealm(const Realm& NewRealm) { m_realms[NewRealm.name] = NewRealm; }
RealmMap::const_iterator begin() const { return m_realms.begin(); }
RealmMap::const_iterator end() const { return m_realms.end(); }
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 93c03e26c88..1ab9ae6eb62 100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -387,7 +387,7 @@ bool AuthSocket::_HandleLogonChallenge()
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString());
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str());
- if (strcmp(fields[4].GetCString(), ip_address.c_str()))
+ if (strcmp(fields[4].GetCString(), ip_address.c_str()) != 0)
{
TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs");
pkt << uint8(WOW_FAIL_LOCKED_ENFORCED);
@@ -930,12 +930,13 @@ bool AuthSocket::_HandleRealmList()
size_t RealmListSize = 0;
for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i)
{
+ const Realm &realm = i->second;
// don't work with realms which not compatible with the client
- bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild));
+ bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && realm.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(realm.gamebuild));
// No SQL injection. id of realm is controlled by the database.
- uint32 flag = i->second.flag;
- RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(i->second.gamebuild);
+ uint32 flag = realm.flag;
+ RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(realm.gamebuild);
if (!okBuild)
{
if (!buildInfo)
@@ -956,27 +957,27 @@ bool AuthSocket::_HandleRealmList()
}
// We don't need the port number from which client connects with but the realm's port
- clientAddr.set_port_number(i->second.ExternalAddress.get_port_number());
+ clientAddr.set_port_number(realm.ExternalAddress.get_port_number());
- uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
+ uint8 lock = (realm.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
uint8 AmountOfCharacters = 0;
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM);
- stmt->setUInt32(0, i->second.m_ID);
+ stmt->setUInt32(0, realm.m_ID);
stmt->setUInt32(1, id);
result = LoginDatabase.Query(stmt);
if (result)
AmountOfCharacters = (*result)[0].GetUInt8();
- pkt << i->second.icon; // realm type
+ pkt << realm.icon; // realm type
if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
pkt << lock; // if 1, then realm locked
pkt << uint8(flag); // RealmFlags
pkt << name;
- pkt << GetAddressString(GetAddressForClient(i->second, clientAddr));
- pkt << i->second.populationLevel;
+ pkt << GetAddressString(GetAddressForClient(realm, clientAddr));
+ pkt << realm.populationLevel;
pkt << AmountOfCharacters;
- pkt << i->second.timezone; // realm category
+ pkt << realm.timezone; // realm category
if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
pkt << uint8(0x2C); // unk, may be realm number/id?
else
diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp
index 6710a6a88ae..88d81132306 100644
--- a/src/server/authserver/Server/RealmSocket.cpp
+++ b/src/server/authserver/Server/RealmSocket.cpp
@@ -45,8 +45,7 @@ RealmSocket::~RealmSocket(void)
// delete RealmSocketObject must never be called from our code.
closing_ = true;
- if (session_)
- delete session_;
+ delete session_;
peer().close();
}
@@ -286,8 +285,7 @@ int RealmSocket::handle_input(ACE_HANDLE)
void RealmSocket::set_session(Session* session)
{
- if (session_ != NULL)
- delete session_;
+ delete session_;
session_ = session;
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index 32fd55fb364..97f91e7ba7a 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -806,7 +806,7 @@ bool BfGraveyard::HasNpc(uint64 guid)
// ********************** Misc ***************************
// *******************************************************
-Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
+Creature* Battlefield::SpawnCreature(uint32 entry, const Position& pos, TeamId team)
{
return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 534bfd620f0..788bbf9cb2e 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -286,7 +286,7 @@ class Battlefield : public ZoneScript
// Misc methods
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
- Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
+ Creature* SpawnCreature(uint32 entry, const Position& pos, TeamId team);
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
Creature* GetCreature(uint64 GUID);
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
index 8044cb96984..8bce2342899 100644
--- a/src/server/game/Battlefield/BattlefieldMgr.cpp
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -74,11 +74,12 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
if (itr == m_BattlefieldMap.end())
return;
- if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
+ Battlefield* bf = itr->second;
+ if (bf->HasPlayer(player) || !bf->IsEnabled())
return;
- itr->second->HandlePlayerEnterZone(player, zoneid);
- TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+ bf->HandlePlayerEnterZone(player, zoneid);
+ TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), bf->GetTypeId());
}
void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index 8bf68cb42fa..e13eddd7672 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -579,8 +579,8 @@ struct WintergraspBuildingSpawnData
struct WintergraspRebuildableBuildingData
{
- uint32 entry;
uint64 Guid;
+ uint32 entry;
uint32 WorldState;
float x;
float y;
@@ -1559,7 +1559,7 @@ struct WintergraspWorkshopData
}
// Spawning associate creature and store them
- void AddCreature(WintergraspObjectPositionData obj)
+ void AddCreature(const WintergraspObjectPositionData& obj)
{
if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
@@ -1569,7 +1569,7 @@ struct WintergraspWorkshopData
}
// Spawning Associate gameobject and store them
- void AddGameObject(WintergraspObjectPositionData obj)
+ void AddGameObject(const WintergraspObjectPositionData& obj)
{
if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject->GetGUID());
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index efd7e0f3d73..557cb9de09f 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -262,6 +262,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
Battleground::BattlegroundScoreMap::const_iterator itr2 = bg->GetPlayerScoresBegin();
for (Battleground::BattlegroundScoreMap::const_iterator itr = itr2; itr != bg->GetPlayerScoresEnd();)
{
+ BattlegroundScore* score = itr2->second;
itr2 = itr++;
if (!bg->IsPlayerInBattleground(itr2->first))
{
@@ -270,12 +271,12 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
*data << uint64(itr2->first);
- *data << uint32(itr2->second->KillingBlows);
+ *data << uint32(score->KillingBlows);
if (type == 0)
{
- *data << uint32(itr2->second->HonorableKills);
- *data << uint32(itr2->second->Deaths);
- *data << uint32(itr2->second->BonusHonor);
+ *data << uint32(score->HonorableKills);
+ *data << uint32(score->Deaths);
+ *data << uint32(score->BonusHonor);
}
else
{
@@ -285,8 +286,8 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
team = player->GetBGTeam();
*data << uint8(team == ALLIANCE ? 1 : 0); // green or yellow
}
- *data << uint32(itr2->second->DamageDone); // damage done
- *data << uint32(itr2->second->HealingDone); // healing done
+ *data << uint32(score->DamageDone); // damage done
+ *data << uint32(score->HealingDone); // healing done
switch (bg->GetTypeID(true)) // battleground specific things
{
case BATTLEGROUND_RB:
@@ -294,35 +295,35 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
{
case 489:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures
- *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns
+ *data << uint32(((BattlegroundWGScore*)score)->FlagCaptures); // flag captures
+ *data << uint32(((BattlegroundWGScore*)score)->FlagReturns); // flag returns
break;
case 566:
*data << uint32(0x00000001); // count of next fields
- *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures
+ *data << uint32(((BattlegroundEYScore*)score)->FlagCaptures); // flag captures
break;
case 529:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted
- *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
+ *data << uint32(((BattlegroundABScore*)score)->BasesAssaulted); // bases asssulted
+ *data << uint32(((BattlegroundABScore*)score)->BasesDefended); // bases defended
break;
case 30:
*data << uint32(0x00000005); // count of next fields
- *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
- *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended
- *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted
- *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended
- *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured
+ *data << uint32(((BattlegroundAVScore*)score)->GraveyardsAssaulted); // GraveyardsAssaulted
+ *data << uint32(((BattlegroundAVScore*)score)->GraveyardsDefended); // GraveyardsDefended
+ *data << uint32(((BattlegroundAVScore*)score)->TowersAssaulted); // TowersAssaulted
+ *data << uint32(((BattlegroundAVScore*)score)->TowersDefended); // TowersDefended
+ *data << uint32(((BattlegroundAVScore*)score)->MinesCaptured); // MinesCaptured
break;
case 607:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
- *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
+ *data << uint32(((BattlegroundSAScore*)score)->demolishers_destroyed);
+ *data << uint32(((BattlegroundSAScore*)score)->gates_destroyed);
break;
case 628: // IC
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted
- *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
+ *data << uint32(((BattlegroundICScore*)score)->BasesAssaulted); // bases asssulted
+ *data << uint32(((BattlegroundICScore*)score)->BasesDefended); // bases defended
default:
*data << uint32(0);
break;
@@ -330,35 +331,35 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
break;
case BATTLEGROUND_AV:
*data << uint32(0x00000005); // count of next fields
- *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
- *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended
- *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted
- *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended
- *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured
+ *data << uint32(((BattlegroundAVScore*)score)->GraveyardsAssaulted); // GraveyardsAssaulted
+ *data << uint32(((BattlegroundAVScore*)score)->GraveyardsDefended); // GraveyardsDefended
+ *data << uint32(((BattlegroundAVScore*)score)->TowersAssaulted); // TowersAssaulted
+ *data << uint32(((BattlegroundAVScore*)score)->TowersDefended); // TowersDefended
+ *data << uint32(((BattlegroundAVScore*)score)->MinesCaptured); // MinesCaptured
break;
case BATTLEGROUND_WS:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures
- *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns
+ *data << uint32(((BattlegroundWGScore*)score)->FlagCaptures); // flag captures
+ *data << uint32(((BattlegroundWGScore*)score)->FlagReturns); // flag returns
break;
case BATTLEGROUND_AB:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases assaulted
- *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
+ *data << uint32(((BattlegroundABScore*)score)->BasesAssaulted); // bases assaulted
+ *data << uint32(((BattlegroundABScore*)score)->BasesDefended); // bases defended
break;
case BATTLEGROUND_EY:
*data << uint32(0x00000001); // count of next fields
- *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures
+ *data << uint32(((BattlegroundEYScore*)score)->FlagCaptures); // flag captures
break;
case BATTLEGROUND_SA:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
- *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
+ *data << uint32(((BattlegroundSAScore*)score)->demolishers_destroyed);
+ *data << uint32(((BattlegroundSAScore*)score)->gates_destroyed);
break;
case BATTLEGROUND_IC:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted
- *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
+ *data << uint32(((BattlegroundICScore*)score)->BasesAssaulted); // bases assaulted
+ *data << uint32(((BattlegroundICScore*)score)->BasesDefended); // bases defended
break;
case BATTLEGROUND_NA:
case BATTLEGROUND_BE:
diff --git a/src/server/game/Calendar/CalendarMgr.h b/src/server/game/Calendar/CalendarMgr.h
index d1b3d0a9dd6..402a8cb00df 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -165,7 +165,7 @@ struct CalendarInvite
void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
time_t GetStatusTime() const { return _statusTime; }
- void SetText(std::string text) { _text = text; }
+ void SetText(const std::string& text) { _text = text; }
std::string GetText() const { return _text; }
void SetStatus(CalendarInviteStatus status) { _status = status; }
@@ -222,10 +222,10 @@ struct CalendarEvent
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
- void SetTitle(std::string title) { _title = title; }
+ void SetTitle(const std::string& title) { _title = title; }
std::string GetTitle() const { return _title; }
- void SetDescription(std::string description) { _description = description; }
+ void SetDescription(const std::string& description) { _description = description; }
std::string GetDescription() const { return _description; }
void SetType(CalendarEventType type) { _type = type; }
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index f8966ba1923..2a3829b7aeb 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -176,18 +176,20 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
if (m_leader) // avoid crash if leader was killed and reset.
TC_LOG_DEBUG(LOG_FILTER_UNITS, "GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId());
- //Skip one check
- if (itr->first == member)
+ Creature* other = itr->first;
+
+ // Skip self
+ if (other == member)
continue;
- if (!itr->first->IsAlive())
+ if (!other->IsAlive())
continue;
- if (itr->first->GetVictim())
+ if (other->GetVictim())
continue;
- if (itr->first->IsValidAttackTarget(target) && itr->first->AI())
- itr->first->AI()->AttackStart(target);
+ if (other->IsValidAttackTarget(target))
+ other->AI()->AttackStart(target);
}
}
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index ed4341dea8a..a0b6fdafb06 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1259,7 +1259,7 @@ void Item::ItemContainerSaveLootToDB()
trans->Append(stmt_items);
// Now insert the items
- for (LootItemList::const_iterator _li = loot.items.begin(); _li != loot.items.end(); _li++)
+ for (LootItemList::const_iterator _li = loot.items.begin(); _li != loot.items.end(); ++_li)
{
// When an item is looted, it doesn't get removed from the items collection
// but we don't want to resave it.
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f5d8cca70e3..7f1d231ebd9 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1732,7 +1732,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
return guid;
}
-bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
+bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, const Position& pos)
{
CreatureData& data = NewOrExistCreatureData(guid);
if (!data.id)
@@ -7323,7 +7323,7 @@ static LanguageType GetRealmLanguageType(bool create)
}
}
-bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bool create = false)
+bool isValidString(const std::wstring& wstr, uint32 strictMask, bool numericOrSpace, bool create = false)
{
if (strictMask == 0) // any language, ignore realm
{
@@ -7627,7 +7627,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
+bool ObjectMgr::CheckDeclinedNames(const std::wstring& w_ownname, DeclinedName const& names)
{
// get main part of the name
std::wstring mainpart = GetMainPartOfName(w_ownname, 0);
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 3fb9369b07d..e44333c4a7a 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -1136,7 +1136,7 @@ class ObjectMgr
void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data);
uint32 AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
uint32 AddCreData(uint32 entry, uint32 team, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
- bool MoveCreData(uint32 guid, uint32 map, Position pos);
+ bool MoveCreData(uint32 guid, uint32 map, const Position& pos);
// reserved names
void LoadReservedPlayersNames();
@@ -1147,7 +1147,7 @@ class ObjectMgr
static PetNameInvalidReason CheckPetName(std::string const& name);
static bool IsValidCharterName(std::string const& name);
- static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names);
+ static bool CheckDeclinedNames(const std::wstring& w_ownname, DeclinedName const& names);
GameTele const* GetGameTele(uint32 id) const
{
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 3c6f002a7fc..ab0f1e572f1 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -1461,7 +1461,7 @@ void Guild::HandleSetMemberNote(WorldSession* session, std::string const& name,
}
}
-void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots)
+void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, const GuildBankRightsAndSlotsVec& rightsAndSlots)
{
// Only leader can modify ranks
if (!_IsLeader(session->GetPlayer()))
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 017221b13bd..fab39f48fca 100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -668,7 +668,7 @@ public:
void HandleSetLeader(WorldSession* session, std::string const& name);
void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon);
void HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool officer);
- void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots);
+ void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, const GuildBankRightsAndSlotsVec& rightsAndSlots);
void HandleBuyBankTab(WorldSession* session, uint8 tabId);
void HandleInviteMember(WorldSession* session, std::string const& name);
void HandleAcceptMember(WorldSession* session);
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 33c21163a4a..cb2e2a8682b 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -1248,7 +1248,7 @@ void LootTemplate::AddEntry(LootStoreItem* item)
Entries.push_back(item);
}
-void LootTemplate::CopyConditions(ConditionList conditions)
+void LootTemplate::CopyConditions(const ConditionList& conditions)
{
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
(*i)->conditions.clear();
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index d338f6f503b..c2f74aab701 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -228,7 +228,7 @@ class LootTemplate
void AddEntry(LootStoreItem* item);
// Rolls for every item in the template and adds the rolled items the the loot
void Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId = 0) const;
- void CopyConditions(ConditionList conditions);
+ void CopyConditions(const ConditionList& conditions);
void CopyConditions(LootItem* li) const;
// True if template includes at least 1 quest drop entry
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 08e66124e4a..3d55d9de16f 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -2243,14 +2243,15 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
// Handle damage modification, shapeshifted druids are not affected
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
{
- if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ Player* player = target->ToPlayer();
+ if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
uint8 attacktype = Player::GetAttackBySlot(slot);
if (attacktype < MAX_ATTACK)
{
- target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply);
- target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
+ player->_ApplyWeaponDamage(slot, item->GetTemplate(), NULL, !apply);
+ player->_ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), !apply);
}
}
}
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 40bfd46e19f..ada26e69c14 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -459,7 +459,7 @@ public:
return false;
}
- if ((pwConfig == PW_EMAIL || pwConfig == PW_RBAC && handler->HasPermission(RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE)) && !emailConfirmation)
+ if ((pwConfig == PW_EMAIL || (pwConfig == PW_RBAC && handler->HasPermission(RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE))) && !emailConfirmation)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
handler->SetSentErrorMessage(true);
@@ -479,7 +479,7 @@ public:
return false;
}
- if ((pwConfig == PW_EMAIL || pwConfig == PW_RBAC && handler->HasPermission(RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE)) // Either PW_EMAIL or PW_RBAC with the Permission
+ if ((pwConfig == PW_EMAIL || (pwConfig == PW_RBAC && handler->HasPermission(RBAC_PERM_EMAIL_CONFIRM_FOR_PASS_CHANGE))) // Either PW_EMAIL or PW_RBAC with the Permission
&& !AccountMgr::CheckEmail(handler->GetSession()->GetAccountId(), std::string(emailConfirmation)))
{
handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL);
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
index 23e7fa8eb98..1b9955ddaf2 100644
--- a/src/server/scripts/Commands/cs_disable.cpp
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -357,7 +357,7 @@ public:
if (!*args)
return false;
- return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_MAP);
}
static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args)
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index bdca4dac1ba..c3d461f6170 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1170,7 +1170,7 @@ public:
int32 amount = 0;
char *rankTxt = strtok(NULL, " ");
- if (!factionTxt || !rankTxt)
+ if (!factionId || !rankTxt)
return false;
amount = atoi(rankTxt);
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
index 3f81b517721..84da194aa2d 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -1016,7 +1016,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript
else if (_icewall == 3)
me->AI()->Talk(SAY_JAINA_ESCAPE_5);
}
- else if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
+ else if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE)
{
if (_icewall == 1)
me->AI()->Talk(SAY_SYLVANAS_ESCAPE_3);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index 32a819e2e0d..c77d05e1150 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -215,8 +215,6 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
// halaa
m_obj = new OPvPCapturePointNA(this);
- if (!m_obj)
- return false;
AddCapturePoint(m_obj);
return true;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index 2193d3841a6..54a1ccece51 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -304,7 +304,7 @@ class instance_blood_furnace : public InstanceMapScript
HandleGameObject(PrisonCell8GUID, false);
}
- void ResetPrisoners(std::set<uint64> prisoners)
+ void ResetPrisoners(const std::set<uint64>& prisoners)
{
for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
@@ -398,7 +398,7 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- void ActivatePrisoners(std::set<uint64> prisoners)
+ void ActivatePrisoners(const std::set<uint64>& prisoners)
{
for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
if (Creature* prisoner = instance->GetCreature(*i))
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index d4bd630ca25..f4da4093dfa 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -350,13 +350,12 @@ void WheatyExceptionReport::PrintSystemInfo()
//===========================================================================
void WheatyExceptionReport::printTracesForAllThreads()
{
- HANDLE hThreadSnap = INVALID_HANDLE_VALUE;
THREADENTRY32 te32;
DWORD dwOwnerPID = GetCurrentProcessId();
m_hProcess = GetCurrentProcess();
// Take a snapshot of all running threads
- hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
+ HANDLE hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hThreadSnap == INVALID_HANDLE_VALUE)
return;
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index a5b2a7b9cc2..6d0216225da 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -242,7 +242,7 @@ inline bool isNumericOrSpace(wchar_t wchar)
return isNumeric(wchar) || wchar == L' ';
}
-inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
+inline bool isBasicLatinString(const std::wstring &wstr, bool numericOrSpace)
{
for (size_t i = 0; i < wstr.size(); ++i)
if (!isBasicLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i])))
@@ -250,7 +250,7 @@ inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
return true;
}
-inline bool isExtendedLatinString(std::wstring wstr, bool numericOrSpace)
+inline bool isExtendedLatinString(const std::wstring &wstr, bool numericOrSpace)
{
for (size_t i = 0; i < wstr.size(); ++i)
if (!isExtendedLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i])))
@@ -258,7 +258,7 @@ inline bool isExtendedLatinString(std::wstring wstr, bool numericOrSpace)
return true;
}
-inline bool isCyrillicString(std::wstring wstr, bool numericOrSpace)
+inline bool isCyrillicString(const std::wstring &wstr, bool numericOrSpace)
{
for (size_t i = 0; i < wstr.size(); ++i)
if (!isCyrillicCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i])))
@@ -266,7 +266,7 @@ inline bool isCyrillicString(std::wstring wstr, bool numericOrSpace)
return true;
}
-inline bool isEastAsianString(std::wstring wstr, bool numericOrSpace)
+inline bool isEastAsianString(const std::wstring &wstr, bool numericOrSpace)
{
for (size_t i = 0; i < wstr.size(); ++i)
if (!isEastAsianCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i])))