Core/Misc: Code-style + some const methods.
This commit is contained in:
@@ -128,7 +128,7 @@ class BIH
|
||||
delete[] dat.primBound;
|
||||
delete[] dat.indices;
|
||||
}
|
||||
uint32 primCount() { return objects.size(); }
|
||||
uint32 primCount() const { return objects.size(); }
|
||||
|
||||
template<typename RayCallback>
|
||||
void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const
|
||||
@@ -400,7 +400,8 @@ class BIH
|
||||
|
||||
void buildHierarchy(std::vector<uint32> &tempTree, buildData &dat, BuildStats &stats);
|
||||
|
||||
void createNode(std::vector<uint32> &tempTree, int nodeIndex, uint32 left, uint32 right) {
|
||||
void createNode(std::vector<uint32> &tempTree, int nodeIndex, uint32 left, uint32 right) const
|
||||
{
|
||||
// write leaf node
|
||||
tempTree[nodeIndex + 0] = (3 << 30) | left;
|
||||
tempTree[nodeIndex + 1] = right - left + 1;
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace VMAP
|
||||
// write WorldModel
|
||||
WorldModel model;
|
||||
model.setRootWmoID(raw_model.RootWMOID);
|
||||
if (raw_model.groupsArray.size())
|
||||
if (!raw_model.groupsArray.empty())
|
||||
{
|
||||
std::vector<GroupModel> groupsArray;
|
||||
|
||||
|
||||
@@ -327,7 +327,6 @@ Player* FollowerAI::GetLeaderForFollower()
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader.");
|
||||
m_uiLeaderGUID = member->GetGUID();
|
||||
return member;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,7 +791,7 @@ LfgProposal* LFGMgr::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FindNewGroup: (%s) - all(%s)", ConcatenateGuids(check).c_str(), ConcatenateGuids(all).c_str());
|
||||
|
||||
LfgProposal* pProposal = NULL;
|
||||
if (!check.size() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal))
|
||||
if (check.empty() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal))
|
||||
return NULL;
|
||||
|
||||
// Try to match with queued groups
|
||||
|
||||
@@ -500,13 +500,13 @@ struct MovementInfo
|
||||
t_seat = -1;
|
||||
}
|
||||
|
||||
uint32 GetMovementFlags() { return flags; }
|
||||
uint32 GetMovementFlags() const { return flags; }
|
||||
void SetMovementFlags(uint32 flag) { flags = flag; }
|
||||
void AddMovementFlag(uint32 flag) { flags |= flag; }
|
||||
void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
|
||||
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
|
||||
|
||||
uint16 GetExtraMovementFlags() { return flags2; }
|
||||
uint16 GetExtraMovementFlags() const { return flags2; }
|
||||
void AddExtraMovementFlag(uint16 flag) { flags2 |= flag; }
|
||||
bool HasExtraMovementFlag(uint16 flag) const { return flags2 & flag; }
|
||||
|
||||
|
||||
@@ -12764,7 +12764,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
|
||||
{
|
||||
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
|
||||
pItem->SetCount(pItem->GetCount() - count + remcount);
|
||||
if (IsInWorld() & update)
|
||||
if (IsInWorld() && update)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
pItem->SetState(ITEM_CHANGED, this);
|
||||
return;
|
||||
@@ -12792,7 +12792,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
|
||||
{
|
||||
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
|
||||
pItem->SetCount(pItem->GetCount() - count + remcount);
|
||||
if (IsInWorld() & update)
|
||||
if (IsInWorld() && update)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
pItem->SetState(ITEM_CHANGED, this);
|
||||
return;
|
||||
@@ -12858,7 +12858,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
|
||||
{
|
||||
ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
|
||||
pItem->SetCount(pItem->GetCount() - count + remcount);
|
||||
if (IsInWorld() & update)
|
||||
if (IsInWorld() && update)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
pItem->SetState(ITEM_CHANGED, this);
|
||||
return;
|
||||
@@ -12966,7 +12966,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update)
|
||||
ItemRemovedQuestCheck(pItem->GetEntry(), count);
|
||||
pItem->SetCount(pItem->GetCount() - count);
|
||||
count = 0;
|
||||
if (IsInWorld() & update)
|
||||
if (IsInWorld() && update)
|
||||
pItem->SendUpdateToPlayer(this);
|
||||
pItem->SetState(ITEM_CHANGED, this);
|
||||
}
|
||||
|
||||
@@ -793,8 +793,8 @@ public:
|
||||
m_dispeller(_dispeller), m_dispellerSpellId(_dispellerSpellId), m_chargesRemoved(_chargesRemoved) {}
|
||||
|
||||
Unit* GetDispeller() { return m_dispeller; }
|
||||
uint32 GetDispellerSpellId() { return m_dispellerSpellId; }
|
||||
uint8 GetRemovedCharges() { return m_chargesRemoved; }
|
||||
uint32 GetDispellerSpellId() const { return m_dispellerSpellId; }
|
||||
uint8 GetRemovedCharges() const { return m_chargesRemoved; }
|
||||
void SetRemovedCharges(uint8 amount)
|
||||
{
|
||||
m_chargesRemoved = amount;
|
||||
|
||||
@@ -4816,11 +4816,11 @@ void ObjectMgr::LoadSpellScriptNames()
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
int32 spellId = fields[0].GetInt32();
|
||||
int32 spellId = fields[0].GetInt32();
|
||||
const char *scriptName = fields[1].GetCString();
|
||||
|
||||
bool allRanks = false;
|
||||
if (spellId <=0)
|
||||
if (spellId <= 0)
|
||||
{
|
||||
allRanks = true;
|
||||
spellId = -spellId;
|
||||
@@ -6553,7 +6553,7 @@ uint32 ObjectMgr::GetBaseXP(uint8 level)
|
||||
return _baseXPTable[level] ? _baseXPTable[level] : 0;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GetXPForLevel(uint8 level)
|
||||
uint32 ObjectMgr::GetXPForLevel(uint8 level) const
|
||||
{
|
||||
if (level < _playerXPperLevel.size())
|
||||
return _playerXPperLevel[level];
|
||||
|
||||
@@ -613,14 +613,14 @@ class ObjectMgr
|
||||
Player* GetPlayerByLowGUID(uint32 lowguid) const;
|
||||
|
||||
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
|
||||
GameObjectTemplateContainer const* GetGameObjectTemplates() { return &_gameObjectTemplateStore; }
|
||||
GameObjectTemplateContainer const* GetGameObjectTemplates() const { return &_gameObjectTemplateStore; }
|
||||
int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32> *skip_vendors);
|
||||
|
||||
void LoadGameObjectTemplate();
|
||||
void AddGameobjectInfo(GameObjectTemplate* goinfo);
|
||||
|
||||
CreatureTemplate const* GetCreatureTemplate(uint32 entry);
|
||||
CreatureTemplateContainer const* GetCreatureTemplates() { return &_creatureTemplateStore; }
|
||||
CreatureTemplateContainer const* GetCreatureTemplates() const { return &_creatureTemplateStore; }
|
||||
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
|
||||
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
|
||||
static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL);
|
||||
@@ -629,7 +629,7 @@ class ObjectMgr
|
||||
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
|
||||
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
|
||||
ItemTemplate const* GetItemTemplate(uint32 entry);
|
||||
ItemTemplateContainer const* GetItemTemplateStore() { return &_itemTemplateStore; }
|
||||
ItemTemplateContainer const* GetItemTemplateStore() const { return &_itemTemplateStore; }
|
||||
|
||||
ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
|
||||
{
|
||||
@@ -912,7 +912,7 @@ class ObjectMgr
|
||||
|
||||
std::string GeneratePetName(uint32 entry);
|
||||
uint32 GetBaseXP(uint8 level);
|
||||
uint32 GetXPForLevel(uint8 level);
|
||||
uint32 GetXPForLevel(uint8 level) const;
|
||||
|
||||
int32 GetFishingBaseSkillLevel(uint32 entry) const
|
||||
{
|
||||
@@ -1098,7 +1098,7 @@ class ObjectMgr
|
||||
|
||||
void LoadScriptNames();
|
||||
ScriptNameContainer &GetScriptNames() { return _scriptNamesStore; }
|
||||
const char * GetScriptName(uint32 id) { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
|
||||
const char * GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
|
||||
uint32 GetScriptId(const char *name);
|
||||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
|
||||
@@ -1230,7 +1230,7 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16 GridMap::getArea(float x, float y)
|
||||
uint16 GridMap::getArea(float x, float y) const
|
||||
{
|
||||
if (!_areaMap)
|
||||
return _gridArea;
|
||||
@@ -1463,7 +1463,7 @@ float GridMap::getHeightFromUint16(float x, float y) const
|
||||
return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
|
||||
}
|
||||
|
||||
float GridMap::getLiquidLevel(float x, float y)
|
||||
float GridMap::getLiquidLevel(float x, float y) const
|
||||
{
|
||||
if (!_liquidMap)
|
||||
return _liquidLevel;
|
||||
@@ -1483,7 +1483,7 @@ float GridMap::getLiquidLevel(float x, float y)
|
||||
}
|
||||
|
||||
// Why does this return LIQUID data?
|
||||
uint8 GridMap::getTerrainType(float x, float y)
|
||||
uint8 GridMap::getTerrainType(float x, float y) const
|
||||
{
|
||||
if (!_liquidFlags)
|
||||
return 0;
|
||||
|
||||
@@ -193,10 +193,10 @@ public:
|
||||
bool loadData(char* filaname);
|
||||
void unloadData();
|
||||
|
||||
uint16 getArea(float x, float y);
|
||||
inline float getHeight(float x, float y) {return (this->*_gridGetHeight)(x, y);}
|
||||
float getLiquidLevel(float x, float y);
|
||||
uint8 getTerrainType(float x, float y);
|
||||
uint16 getArea(float x, float y) const;
|
||||
inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
|
||||
float getLiquidLevel(float x, float y) const;
|
||||
uint8 getTerrainType(float x, float y) const;
|
||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ class MapManager
|
||||
void RegisterInstanceId(uint32 instanceId);
|
||||
void FreeInstanceId(uint32 instanceId);
|
||||
|
||||
uint32 GetNextInstanceId() { return _nextInstanceId; };
|
||||
uint32 GetNextInstanceId() const { return _nextInstanceId; };
|
||||
void SetNextInstanceId(uint32 nextInstanceId) { _nextInstanceId = nextInstanceId; };
|
||||
|
||||
MapUpdater * GetMapUpdater() { return &m_updater; }
|
||||
|
||||
@@ -323,7 +323,7 @@ class WorldSession
|
||||
void LoadTutorialsData();
|
||||
void SendTutorialsData();
|
||||
void SaveTutorialsData(SQLTransaction& trans);
|
||||
uint32 GetTutorialInt(uint8 index) { return m_Tutorials[index]; }
|
||||
uint32 GetTutorialInt(uint8 index) const { return m_Tutorials[index]; }
|
||||
void SetTutorialInt(uint8 index, uint32 value)
|
||||
{
|
||||
if (m_Tutorials[index] != value)
|
||||
@@ -390,8 +390,8 @@ class WorldSession
|
||||
}
|
||||
|
||||
// Recruit-A-Friend Handling
|
||||
uint32 GetRecruiterId() { return recruiterId; }
|
||||
bool IsARecruiter() { return isRecruiter; }
|
||||
uint32 GetRecruiterId() const { return recruiterId; }
|
||||
bool IsARecruiter() const { return isRecruiter; }
|
||||
|
||||
public: // opcodes handlers
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ struct ServerPktHeader
|
||||
return 2+(isLargePacket()?3:2);
|
||||
}
|
||||
|
||||
bool isLargePacket()
|
||||
bool isLargePacket() const
|
||||
{
|
||||
return size > 0x7FFF;
|
||||
}
|
||||
|
||||
@@ -3548,7 +3548,7 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
|
||||
break;
|
||||
}
|
||||
|
||||
if (aura_immunity_list.size() == 0)
|
||||
if (aura_immunity_list.empty())
|
||||
{
|
||||
if (miscVal & (1<<10))
|
||||
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
|
||||
|
||||
@@ -196,7 +196,6 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
||||
sWorld->BanAccount(BAN_ACCOUNT, accountName, duration.str(), banReason.str(),"Server");
|
||||
|
||||
return "Ban";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -222,7 +222,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
// return;
|
||||
//}
|
||||
|
||||
bool found = false;
|
||||
//bool found = false;
|
||||
|
||||
std::string str = "Test string!";
|
||||
|
||||
@@ -238,7 +238,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
if (memcmp(sha1Hash, sha1.GetDigest(), 20))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: SHA1 hash is wrong!");
|
||||
found = true;
|
||||
//found = true;
|
||||
}
|
||||
|
||||
MD5_CTX ctx;
|
||||
@@ -253,7 +253,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
if (memcmp(ourMD5Hash, theirsMD5Hash, 16))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: MD5 hash is wrong!");
|
||||
found = true;
|
||||
//found = true;
|
||||
}
|
||||
|
||||
_session->KickPlayer();
|
||||
|
||||
Reference in New Issue
Block a user