[7509] Use defines instead explcit value for talent rank cound (in general and for pets) Author: VladimirMangos

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-21 14:55:10 -06:00
parent 42d5b79eea
commit 7de6113d90
8 changed files with 26 additions and 23 deletions
+13 -13
View File
@@ -2818,7 +2818,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
{
for(int i=0; i <5; ++i)
for(int i=0; i < MAX_TALENT_RANK; ++i)
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[i];
@@ -3440,7 +3440,7 @@ bool Player::resetTalents(bool no_cost)
if( (getClassMask() & talentTabInfo->ClassMask) == 0 )
continue;
for (int j = 0; j < 5; j++)
for (int j = 0; j < MAX_TALENT_RANK; j++)
{
for(PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
{
@@ -20627,7 +20627,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
if(CurTalentPoints == 0)
return;
if (talentRank > 4)
if (talentRank >= MAX_TALENT_RANK)
return;
TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentId );
@@ -20646,7 +20646,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
for(int32 k = 4; k > -1; --k)
for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))
{
@@ -20669,7 +20669,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
for (int i = talentInfo->DependsOnRank; i <= 4; i++)
for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++)
{
if (depTalentInfo->RankID[i] != 0)
if (HasSpell(depTalentInfo->RankID[i]))
@@ -20695,7 +20695,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
{
if (tmpTalent->TalentTab == tTab)
{
for (int j = 0; j <= 4; j++)
for (int j = 0; j < MAX_TALENT_RANK; j++)
{
if (tmpTalent->RankID[j] != 0)
{
@@ -20711,7 +20711,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
if(spentPoints < (talentInfo->Row * 5))
if(spentPoints < (talentInfo->Row * MAX_TALENT_RANK))
return;
// spell not set in talent.dbc
@@ -20749,7 +20749,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if(CurTalentPoints == 0)
return;
if (talentRank > 2)
if (talentRank >= MAX_PET_TALENT_RANK)
return;
TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId);
@@ -20781,7 +20781,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
for(int32 k = 4; k > -1; --k)
for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && pet->HasSpell(talentInfo->RankID[k]))
{
@@ -20804,7 +20804,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
{
bool hasEnoughRank = false;
for (int i = talentInfo->DependsOnRank; i <= 4; i++)
for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++)
{
if (depTalentInfo->RankID[i] != 0)
if (pet->HasSpell(depTalentInfo->RankID[i]))
@@ -20830,7 +20830,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
{
if (tmpTalent->TalentTab == tTab)
{
for (int j = 0; j <= 4; j++)
for (int j = 0; j < MAX_TALENT_RANK; j++)
{
if (tmpTalent->RankID[j] != 0)
{
@@ -20846,7 +20846,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
}
// not have required min points spent in talent tree
if(spentPoints < (talentInfo->Row * 3))
if(spentPoints < (talentInfo->Row * MAX_PET_TALENT_RANK))
return;
// spell not set in talent.dbc
@@ -20863,7 +20863,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// learn! (other talent ranks will unlearned at learning)
pet->learnSpell(spellid);
sLog.outDetail("TalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
sLog.outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
// update free talent points
pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));