Core/Guids: optimize guild recipe querying by avoiding unnecessary copys of profession data elements
This commit is contained in:
1 parent
1a1f0b767d
commit
04df69a8ed
3 files changed
+11
-13
No files matched your search
@@ -1555,9 +1555,10 @@ void Guild::HandleRoster(WorldSession* session)
|
||||
|
||||
for (uint8 i = 0; i < GUILD_PROFESSION_COUNT; i++)
|
||||
{
|
||||
memberData.Profession[i].DbID = member->GetProfessionData(i).SkillId;
|
||||
memberData.Profession[i].Step = member->GetProfessionData(i).Step;
|
||||
memberData.Profession[i].Rank = member->GetProfessionData(i).Rank;
|
||||
GuildMemberProfessionData const& profData = member->GetProfessionData(i);
|
||||
memberData.Profession[i].DbID = profData.SkillId;
|
||||
memberData.Profession[i].Step = profData.Step;
|
||||
memberData.Profession[i].Rank = profData.Rank;
|
||||
}
|
||||
|
||||
memberData.VirtualRealmAddress = 0;
|
||||
@@ -4027,7 +4028,7 @@ void Guild::SendKnownRecipes(Player const* player)
|
||||
|
||||
for (uint8 i = 0; i < GUILD_PROFESSION_COUNT; i++)
|
||||
{
|
||||
GuildMemberProfessionData prof = member->GetProfessionData(i);
|
||||
GuildMemberProfessionData const& prof = member->GetProfessionData(i);
|
||||
if (uint32 skillId = prof.SkillId)
|
||||
{
|
||||
uniqueProfessions.insert(skillId);
|
||||
@@ -4039,13 +4040,10 @@ void Guild::SendKnownRecipes(Player const* player)
|
||||
|
||||
for (uint32 skill : uniqueProfessions)
|
||||
{
|
||||
WorldPackets::Guild::GuildRecipesData data;
|
||||
data.SkillLineBitArray.fill(0);
|
||||
WorldPackets::Guild::GuildRecipesData& data = packet.Recipes.emplace_back();
|
||||
data.SkillLineID = skill;
|
||||
for (uint16 i = 0; i < data.SkillLineBitArray.max_size(); i++)
|
||||
data.SkillLineBitArray[i] = uniqueBitsMap[skill][i];
|
||||
|
||||
packet.Recipes.push_back(data);
|
||||
}
|
||||
|
||||
player->SendDirectMessage(packet.Write());
|
||||
@@ -4059,7 +4057,7 @@ void Guild::SendMembersForRecipe(Player const* player, uint32 skillLineId, uint3
|
||||
Member* member = itr.second;
|
||||
for (uint8 i = 0; i < GUILD_PROFESSION_COUNT; i++)
|
||||
{
|
||||
GuildMemberProfessionData prof = member->GetProfessionData(i);
|
||||
GuildMemberProfessionData const& prof = member->GetProfessionData(i);
|
||||
if (prof.SkillId == skillLineId)
|
||||
{
|
||||
uint16 index = uniqueBit / 8;
|
||||
@@ -4085,7 +4083,7 @@ void Guild::SendRecipesOfMember(Player const* player, uint32 skillLineId, Object
|
||||
|
||||
for (uint8 i = 0; i < GUILD_PROFESSION_COUNT; i++)
|
||||
{
|
||||
GuildMemberProfessionData prof = member->GetProfessionData(i);
|
||||
GuildMemberProfessionData const& prof = member->GetProfessionData(i);
|
||||
if (prof.SkillId == skillLineId)
|
||||
{
|
||||
packet.SkillLineID = skillLineId;
|
||||
|
||||
@@ -407,7 +407,7 @@ private:
|
||||
uint64 GetWeekActivity() const { return m_weekActivity; }
|
||||
uint32 GetTotalReputation() const { return m_totalReputation; }
|
||||
uint32 GetWeekReputation() const { return m_weekReputation; }
|
||||
GuildMemberProfessionData GetProfessionData(uint8 index) const { return m_professions[index]; }
|
||||
GuildMemberProfessionData const& GetProfessionData(uint8 index) const { return m_professions[index]; }
|
||||
|
||||
std::set<uint32> GetTrackedCriteriaIds() const { return m_trackedCriteriaIds; }
|
||||
void SetTrackedCriteriaIds(std::set<uint32> criteriaIds) { m_trackedCriteriaIds.swap(criteriaIds); }
|
||||
|
||||
@@ -339,8 +339,8 @@ namespace WorldPackets
|
||||
|
||||
struct GuildRecipesData
|
||||
{
|
||||
uint32 SkillLineID;
|
||||
std::array<uint8, GUILD_RECIPES_COUNT> SkillLineBitArray;
|
||||
uint32 SkillLineID = 0;
|
||||
std::array<uint8, GUILD_RECIPES_COUNT> SkillLineBitArray = { };
|
||||
};
|
||||
|
||||
class GuildKnownRecipes final : public ServerPacket
|
||||
|
||||
Reference in new issue
Block a user