mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11482] Reorder some fields for better memory layout
This commit is contained in:
parent
a0729866d3
commit
4cfa51d799
4 changed files with 26 additions and 25 deletions
|
|
@ -953,11 +953,11 @@ namespace MaNGOS
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
bool i_targetForUnit;
|
|
||||||
bool i_targetForPlayer;
|
|
||||||
WorldObject const* i_obj;
|
WorldObject const* i_obj;
|
||||||
WorldObject const* i_originalCaster;
|
WorldObject const* i_originalCaster;
|
||||||
float i_range;
|
float i_range;
|
||||||
|
bool i_targetForUnit;
|
||||||
|
bool i_targetForPlayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnyAoETargetUnitInObjectRangeCheck
|
class AnyAoETargetUnitInObjectRangeCheck
|
||||||
|
|
@ -985,9 +985,9 @@ namespace MaNGOS
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool i_targetForPlayer;
|
|
||||||
WorldObject const* i_obj;
|
WorldObject const* i_obj;
|
||||||
float i_range;
|
float i_range;
|
||||||
|
bool i_targetForPlayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
// do attack at call of help to friendly crearture
|
// do attack at call of help to friendly crearture
|
||||||
|
|
|
||||||
|
|
@ -3226,8 +3226,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
{
|
{
|
||||||
PlayerTalent talent;
|
PlayerTalent talent;
|
||||||
talent.currentRank = talentPos->rank;
|
talent.currentRank = talentPos->rank;
|
||||||
talent.m_talentEntry = sTalentStore.LookupEntry(talentPos->talent_id);
|
talent.talentEntry = sTalentStore.LookupEntry(talentPos->talent_id);
|
||||||
talent.state = IsInWorld() ? PLAYERSPELL_NEW : PLAYERSPELL_UNCHANGED;
|
talent.state = IsInWorld() ? PLAYERSPELL_NEW : PLAYERSPELL_UNCHANGED;
|
||||||
m_talents[m_activeSpec][talentPos->talent_id] = talent;
|
m_talents[m_activeSpec][talentPos->talent_id] = talent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3803,14 +3803,14 @@ bool Player::resetTalents(bool no_cost, bool all_specs)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TalentEntry const *talentInfo = (*iter).second.m_talentEntry;
|
TalentEntry const* talentInfo = iter->second.talentEntry;
|
||||||
if (!talentInfo)
|
if (!talentInfo)
|
||||||
{
|
{
|
||||||
m_talents[m_activeSpec].erase(iter++);
|
m_talents[m_activeSpec].erase(iter++);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
|
|
||||||
if (!talentTabInfo)
|
if (!talentTabInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -16665,7 +16665,7 @@ void Player::_LoadTalents(QueryResult *result)
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
uint32 talent_id = fields[0].GetUInt32();
|
uint32 talent_id = fields[0].GetUInt32();
|
||||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talent_id );
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id);
|
||||||
|
|
||||||
if (!talentInfo)
|
if (!talentInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -16674,7 +16674,7 @@ void Player::_LoadTalents(QueryResult *result)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
|
|
||||||
if (!talentTabInfo)
|
if (!talentTabInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -16722,8 +16722,8 @@ void Player::_LoadTalents(QueryResult *result)
|
||||||
{
|
{
|
||||||
PlayerTalent talent;
|
PlayerTalent talent;
|
||||||
talent.currentRank = currentRank;
|
talent.currentRank = currentRank;
|
||||||
talent.m_talentEntry = talentInfo;
|
talent.talentEntry = talentInfo;
|
||||||
talent.state = PLAYERSPELL_UNCHANGED;
|
talent.state = PLAYERSPELL_UNCHANGED;
|
||||||
m_talents[spec][talentInfo->TalentID] = talent;
|
m_talents[spec][talentInfo->TalentID] = talent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16731,6 +16731,7 @@ void Player::_LoadTalents(QueryResult *result)
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_LoadGroup(QueryResult *result)
|
void Player::_LoadGroup(QueryResult *result)
|
||||||
{
|
{
|
||||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT groupId FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
//QueryResult *result = CharacterDatabase.PQuery("SELECT groupId FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
||||||
|
|
@ -21818,7 +21819,7 @@ PlayerTalent const* Player::GetKnownTalentById(int32 talentId) const
|
||||||
SpellEntry const* Player::GetKnownTalentRankById(int32 talentId) const
|
SpellEntry const* Player::GetKnownTalentRankById(int32 talentId) const
|
||||||
{
|
{
|
||||||
if (PlayerTalent const* talent = GetKnownTalentById(talentId))
|
if (PlayerTalent const* talent = GetKnownTalentById(talentId))
|
||||||
return sSpellStore.LookupEntry(talent->m_talentEntry->RankID[talent->currentRank]);
|
return sSpellStore.LookupEntry(talent->talentEntry->RankID[talent->currentRank]);
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -21833,12 +21834,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
||||||
if (talentRank >= MAX_TALENT_RANK)
|
if (talentRank >= MAX_TALENT_RANK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId );
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
|
||||||
|
|
||||||
if(!talentInfo)
|
if(!talentInfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry( talentInfo->TalentTab );
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
|
|
||||||
if(!talentTabInfo)
|
if(!talentTabInfo)
|
||||||
return;
|
return;
|
||||||
|
|
@ -21886,7 +21887,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
||||||
if (talentInfo->Row > 0)
|
if (talentInfo->Row > 0)
|
||||||
{
|
{
|
||||||
for (PlayerTalentMap::const_iterator iter = m_talents[m_activeSpec].begin(); iter != m_talents[m_activeSpec].end(); ++iter)
|
for (PlayerTalentMap::const_iterator iter = m_talents[m_activeSpec].begin(); iter != m_talents[m_activeSpec].end(); ++iter)
|
||||||
if (iter->second.state != PLAYERSPELL_REMOVED && iter->second.m_talentEntry->TalentTab == tTab)
|
if (iter->second.state != PLAYERSPELL_REMOVED && iter->second.talentEntry->TalentTab == tTab)
|
||||||
spentPoints += iter->second.currentRank + 1;
|
spentPoints += iter->second.currentRank + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22132,10 +22133,10 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip another tab talents
|
// skip another tab talents
|
||||||
if(talent.m_talentEntry->TalentTab != talentTabId)
|
if (talent.talentEntry->TalentTab != talentTabId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*data << uint32(talent.m_talentEntry->TalentID); // Talent.dbc
|
*data << uint32(talent.talentEntry->TalentID); // Talent.dbc
|
||||||
*data << uint8(talent.currentRank); // talentMaxRank (0-4)
|
*data << uint8(talent.currentRank); // talentMaxRank (0-4)
|
||||||
|
|
||||||
++talentIdCount;
|
++talentIdCount;
|
||||||
|
|
@ -22485,7 +22486,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
// remove all talent spells that don't exist in next spec but exist in old
|
// remove all talent spells that don't exist in next spec but exist in old
|
||||||
for (PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].begin(); specIter != m_talents[m_activeSpec].end();)
|
for (PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].begin(); specIter != m_talents[m_activeSpec].end();)
|
||||||
{
|
{
|
||||||
PlayerTalent& talent = (*specIter).second;
|
PlayerTalent& talent = specIter->second;
|
||||||
|
|
||||||
if (talent.state == PLAYERSPELL_REMOVED)
|
if (talent.state == PLAYERSPELL_REMOVED)
|
||||||
{
|
{
|
||||||
|
|
@ -22498,7 +22499,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
// remove any talent rank if talent not listed in temp spec
|
// remove any talent rank if talent not listed in temp spec
|
||||||
if (iterTempSpec == tempSpec.end() || iterTempSpec->second.state == PLAYERSPELL_REMOVED)
|
if (iterTempSpec == tempSpec.end() || iterTempSpec->second.state == PLAYERSPELL_REMOVED)
|
||||||
{
|
{
|
||||||
TalentEntry const *talentInfo = talent.m_talentEntry;
|
TalentEntry const *talentInfo = talent.talentEntry;
|
||||||
|
|
||||||
for(int r = 0; r < MAX_TALENT_RANK; ++r)
|
for(int r = 0; r < MAX_TALENT_RANK; ++r)
|
||||||
if (talentInfo->RankID[r])
|
if (talentInfo->RankID[r])
|
||||||
|
|
@ -22513,7 +22514,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
// now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then.
|
// now new spec data have only talents (maybe different rank) as in temp spec data, sync ranks then.
|
||||||
for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter)
|
for (PlayerTalentMap::const_iterator tempIter = tempSpec.begin(); tempIter != tempSpec.end(); ++tempIter)
|
||||||
{
|
{
|
||||||
PlayerTalent const& talent = (*tempIter).second;
|
PlayerTalent const& talent = tempIter->second;
|
||||||
|
|
||||||
// removed state talent already unlearned in prev. loop
|
// removed state talent already unlearned in prev. loop
|
||||||
// but we need restore it if it deleted for finish removed-marked data in DB
|
// but we need restore it if it deleted for finish removed-marked data in DB
|
||||||
|
|
@ -22523,7 +22524,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 talentSpellId = talent.m_talentEntry->RankID[talent.currentRank];
|
uint32 talentSpellId = talent.talentEntry->RankID[talent.currentRank];
|
||||||
|
|
||||||
// learn talent spells if they not in new spec (old spec copy)
|
// learn talent spells if they not in new spec (old spec copy)
|
||||||
// and if they have different rank
|
// and if they have different rank
|
||||||
|
|
@ -22538,7 +22539,7 @@ void Player::ActivateSpec(uint8 specNum)
|
||||||
// sync states - original state is changed in addSpell that learnSpell calls
|
// sync states - original state is changed in addSpell that learnSpell calls
|
||||||
PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].find(tempIter->first);
|
PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].find(tempIter->first);
|
||||||
if (specIter != m_talents[m_activeSpec].end())
|
if (specIter != m_talents[m_activeSpec].end())
|
||||||
(*specIter).second.state = talent.state;
|
specIter->second.state = talent.state;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outError("ActivateSpec: Talent spell %u expected to learned at spec switch but not listed in talents at final check!", talentSpellId);
|
sLog.outError("ActivateSpec: Talent spell %u expected to learned at spec switch but not listed in talents at final check!", talentSpellId);
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,9 @@ struct PlayerSpell
|
||||||
|
|
||||||
struct PlayerTalent
|
struct PlayerTalent
|
||||||
{
|
{
|
||||||
PlayerSpellState state;
|
TalentEntry const *talentEntry;
|
||||||
TalentEntry const *m_talentEntry;
|
|
||||||
uint32 currentRank;
|
uint32 currentRank;
|
||||||
|
PlayerSpellState state;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, PlayerSpell> PlayerSpellMap;
|
typedef UNORDERED_MAP<uint32, PlayerSpell> PlayerSpellMap;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11481"
|
#define REVISION_NR "11482"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue