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