aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <none@none>2009-06-18 18:29:28 +0200
committerMachiavelli <none@none>2009-06-18 18:29:28 +0200
commita4dafbf8ec26fa33ce51140bb77b0b1a68df93ff (patch)
tree5850e3965f0eabb6a17433fa5737d807bad84406
parent1f871af996eb837d7a191fb947bcf565f4592c1c (diff)
* More updating of iterator data types in loops
--HG-- branch : trunk
-rw-r--r--src/game/Bag.cpp4
-rw-r--r--src/game/Guild.cpp16
-rw-r--r--src/game/Level3.cpp2
-rw-r--r--src/game/ObjectMgr.cpp67
-rw-r--r--src/game/Pet.cpp6
-rw-r--r--src/game/PetHandler.cpp6
-rw-r--r--src/game/Player.cpp8
-rw-r--r--src/game/Player.h28
-rw-r--r--src/game/SpellEffects.cpp16
-rw-r--r--src/game/Unit.cpp68
-rw-r--r--src/game/Unit.h4
11 files changed, 113 insertions, 112 deletions
diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp
index 223c40848b2..98870b915eb 100644
--- a/src/game/Bag.cpp
+++ b/src/game/Bag.cpp
@@ -105,7 +105,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
return false;
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
- for (int i = 0; i < MAX_BAG_SIZE; ++i)
+ for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
{
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
if (m_bagslot[i])
@@ -120,7 +120,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
void Bag::DeleteFromDB()
{
- for (int i = 0; i < MAX_BAG_SIZE; ++i)
+ for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
if (m_bagslot[i])
m_bagslot[i]->DeleteFromDB();
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp
index 811fc4b2b66..84271f08d04 100644
--- a/src/game/Guild.cpp
+++ b/src/game/Guild.cpp
@@ -126,7 +126,7 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank)
newmember.Pnote = (std::string)"";
newmember.logout_time = time(NULL);
newmember.BankResetTimeMoney = 0; // this will force update at first query
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
newmember.BankResetTimeTab[i] = 0;
members[GUID_LOPART(plGuid)] = newmember;
@@ -320,7 +320,7 @@ bool Guild::LoadMembersFromDB(uint32 GuildId)
newmember.OFFnote = fields[3].GetCppString();
newmember.BankResetTimeMoney = fields[4].GetUInt32();
newmember.BankRemMoney = fields[5].GetUInt32();
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
newmember.BankResetTimeTab[i] = fields[6+(2*i)].GetUInt32();
newmember.BankRemSlotsTab[i] = fields[7+(2*i)].GetUInt32();
@@ -605,7 +605,7 @@ void Guild::CreateRank(std::string name_,uint32 rights)
AddRank(name_,rights,0);
- for (int i = 0; i < purchased_tabs; ++i)
+ for (uint8 i = 0; i < purchased_tabs; ++i)
{
CreateBankRightForTab(m_ranks.size()-1, uint8(i));
}
@@ -718,7 +718,7 @@ void Guild::Roster(WorldSession *session)
{
data << (uint32)ritr->rights;
data << (uint32)ritr->BankMoneyPerDay; // count of: withdraw gold(gold/day) Note: in game set gold, in packet set bronze.
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
data << (uint32)ritr->TabRight[i]; // for TAB_i rights: view tabs = 0x01, deposit items =0x02
data << (uint32)ritr->TabSlotPerDay[i]; // for TAB_i count of: withdraw items(stack/day)
@@ -961,7 +961,7 @@ void Guild::DisplayGuildBankContent(WorldSession *session, uint8 TabId)
data << uint8(GUILD_BANK_MAX_SLOTS);
- for (int i=0; i<GUILD_BANK_MAX_SLOTS; ++i)
+ for (uint8 i=0; i<GUILD_BANK_MAX_SLOTS; ++i)
AppendDisplayGuildBankSlot(data, tab, i);
session->SendPacket(&data);
@@ -1436,7 +1436,7 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
{
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == rankId)
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
itr->second.BankResetTimeTab[i] = 0;
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid='%u' AND TabId='%u' AND rid='%u'", Id, uint32(TabId), rankId);
@@ -1545,7 +1545,7 @@ void Guild::LoadGuildBankEventLogFromDB()
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid=%u AND LogGuid < %u",
Id, m_GuildBankEventLog_Money.front()->LogGuid);
}
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
if (!m_GuildBankEventLog_Item[i].empty())
{
@@ -1568,7 +1568,7 @@ void Guild::UnloadGuildBankEventLog()
}while( !m_GuildBankEventLog_Money.empty() );
}
- for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
+ for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
if( !m_GuildBankEventLog_Item[i].empty() )
{
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 6f98244a811..5e8ca3f3c30 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -5085,7 +5085,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
}
}
- for (int i = 0; i < TOTAL_AURAS; ++i)
+ for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
Unit::AuraEffectList const& uAuraList = unit->GetAurasByType(AuraType(i));
if (uAuraList.empty()) continue;
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index c088bc66c9f..a45722449ca 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -101,7 +101,7 @@ LanguageDesc lang_description[LANGUAGES_COUNT] =
LanguageDesc const* GetLanguageDescByID(uint32 lang)
{
- for(int i = 0; i < LANGUAGES_COUNT; ++i)
+ for(uint8 i = 0; i < LANGUAGES_COUNT; ++i)
{
if(uint32(lang_description[i].lang_id) == lang)
return &lang_description[i];
@@ -365,7 +365,7 @@ void ObjectMgr::LoadCreatureLocales()
CreatureLocale& data = mCreatureLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
if(!str.empty())
@@ -433,7 +433,7 @@ void ObjectMgr::LoadNpcOptionLocales()
NpcOptionLocale& data = mNpcOptionLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
if(!str.empty())
@@ -496,7 +496,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
PointOfInterestLocale& data = mPointOfInterestLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
if(str.empty())
@@ -753,7 +753,7 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u)", cInfo->Entry, cInfo->PetSpellDataId);
}
- for(int j = 0; j < CREATURE_MAX_SPELLS; ++j)
+ for(uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
if(cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
{
@@ -831,7 +831,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1];
int i=0;
- for(int j=0;j<val.size()/2;++j)
+ for(uint32 j=0;j<val.size()/2;++j)
{
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
cAura.spell_id = (uint32)val[2*j+0];
@@ -1811,7 +1811,7 @@ void ObjectMgr::LoadItemLocales()
ItemLocale& data = mItemLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+2*(i-1)].GetCppString();
if(!str.empty())
@@ -2294,7 +2294,7 @@ void ObjectMgr::LoadItemRequiredTarget()
bool bIsItemSpellValid = false;
- for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
+ for(uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
if (SpellEntry const* pSpellInfo = sSpellStore.LookupEntry(pItemProto->Spells[i].SpellId))
{
@@ -3065,7 +3065,8 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
// base data (last known level)
*info = playerInfo[race][_class].levelInfo[sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
- for(int lvl = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
+ // if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
+ for(uint8 lvl = sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
{
switch(_class)
{
@@ -3477,7 +3478,7 @@ void ObjectMgr::LoadQuests()
if(qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
{
// at auto-reward can be rewarded only RewChoiceItemId[0]
- for(int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
+ for(uint8 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{
if(uint32 id = qinfo->RewChoiceItemId[j])
{
@@ -3671,7 +3672,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{
uint32 id = qinfo->ReqItemId[j];
if(id)
@@ -3700,7 +3701,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j )
{
uint32 id = qinfo->ReqSourceId[j];
if(id)
@@ -3723,7 +3724,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{
uint32 id = qinfo->ReqSpell[j];
if(id)
@@ -3739,7 +3740,7 @@ void ObjectMgr::LoadQuests()
if(!qinfo->ReqCreatureOrGOId[j])
{
bool found = false;
- for(int k = 0; k < 3; ++k)
+ for(uint8 k = 0; k < 3; ++k)
{
if( spellInfo->Effect[k]==SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k])==qinfo->QuestId ||
spellInfo->Effect[k]==SPELL_EFFECT_SEND_EVENT)
@@ -3769,7 +3770,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j )
{
int32 id = qinfo->ReqCreatureOrGOId[j];
if(id < 0 && !sGOStorage.LookupEntry<GameObjectInfo>(-id))
@@ -3807,7 +3808,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_REWARD_CHOICES_COUNT; ++j )
{
uint32 id = qinfo->RewChoiceItemId[j];
if(id)
@@ -3834,7 +3835,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_REWARDS_COUNT; ++j )
+ for(uint8 j = 0; j < QUEST_REWARDS_COUNT; ++j )
{
uint32 id = qinfo->RewItemId[j];
if(id)
@@ -3861,7 +3862,7 @@ void ObjectMgr::LoadQuests()
}
}
- for(int j = 0; j < QUEST_REPUTATIONS_COUNT; ++j)
+ for(uint8 j = 0; j < QUEST_REPUTATIONS_COUNT; ++j)
{
if(qinfo->RewRepFaction[j])
{
@@ -3991,7 +3992,7 @@ void ObjectMgr::LoadQuests()
if(!spellInfo)
continue;
- for(int j = 0; j < 3; ++j)
+ for(uint8 j = 0; j < 3; ++j)
{
if(spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
continue;
@@ -4056,7 +4057,7 @@ void ObjectMgr::LoadQuestLocales()
QuestLocale& data = mQuestLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[1+10*(i-1)].GetCppString();
if(!str.empty())
@@ -4130,7 +4131,7 @@ void ObjectMgr::LoadQuestLocales()
data.EndText[idx] = str;
}
}
- for(int k = 0; k < 4; ++k)
+ for(uint8 k = 0; k < 4; ++k)
{
str = fields[1+10*(i-1)+6+k].GetCppString();
if(!str.empty())
@@ -4461,7 +4462,7 @@ void ObjectMgr::LoadSpellScripts()
//check for correct spellEffect
bool found = false;
- for(int i=0; i<3; ++i)
+ for(uint8 i=0; i<3; ++i)
{
// skip empty effects
if( !spellInfo->Effect[i] )
@@ -4514,7 +4515,7 @@ void ObjectMgr::LoadEventScripts()
SpellEntry const * spell = sSpellStore.LookupEntry(i);
if (spell)
{
- for(int j=0; j<3; ++j)
+ for(uint8 j=0; j<3; ++j)
{
if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
{
@@ -4656,7 +4657,7 @@ void ObjectMgr::LoadPageTextLocales()
PageTextLocale& data = mPageTextLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
if(str.empty())
@@ -4787,7 +4788,7 @@ void ObjectMgr::LoadGossipText()
gText.Options[i].Language = fields[cic++].GetUInt32();
gText.Options[i].Probability = fields[cic++].GetFloat();
- for(int j=0; j < 3; ++j)
+ for(uint8 j=0; j < 3; ++j)
{
gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32();
gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32();
@@ -4837,9 +4838,9 @@ void ObjectMgr::LoadNpcTextLocales()
NpcTextLocale& data = mNpcTextLocaleMap[entry];
- for(int i=1; i<MAX_LOCALE; ++i)
+ for(uint8 i=1; i<MAX_LOCALE; ++i)
{
- for(int j=0; j<8; ++j)
+ for(uint8 j=0; j<8; ++j)
{
std::string str0 = fields[1+8*2*(i-1)+2*j].GetCppString();
if(!str0.empty())
@@ -6024,7 +6025,7 @@ void ObjectMgr::LoadGameObjectLocales()
GameObjectLocale& data = mGameObjectLocaleMap[entry];
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i].GetCppString();
if(!str.empty())
@@ -6040,7 +6041,7 @@ void ObjectMgr::LoadGameObjectLocales()
}
}
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i+(MAX_LOCALE-1)].GetCppString();
if(!str.empty())
@@ -6709,7 +6710,7 @@ void ObjectMgr::LoadWeatherZoneChances()
WeatherZoneChances& wzc = mWeatherZoneMap[zone_id];
- for(int season = 0; season < WEATHER_SEASONS; ++season)
+ for(uint8 season = 0; season < WEATHER_SEASONS; ++season)
{
wzc.data[season].rainChance = fields[season * (MAX_WEATHER_TYPE-1) + 1].GetUInt32();
wzc.data[season].snowChance = fields[season * (MAX_WEATHER_TYPE-1) + 2].GetUInt32();
@@ -7271,7 +7272,7 @@ bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 mi
// 0 -> default, idx in to idx+1
data.Content[0] = fields[1].GetCppString();
- for(int i = 1; i < MAX_LOCALE; ++i)
+ for(uint8 i = 1; i < MAX_LOCALE; ++i)
{
std::string str = fields[i+1].GetCppString();
if (!str.empty())
@@ -7437,7 +7438,7 @@ uint16 ObjectMgr::GetConditionId( ConditionType condition, uint32 value1, uint32
bool ObjectMgr::CheckDeclinedNames( std::wstring mainpart, DeclinedName const& names )
{
- for(int i =0; i < MAX_DECLINED_NAME_CASES; ++i)
+ for(uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
{
std::wstring wname;
if(!Utf8toWStr(names.name[i],wname))
@@ -7903,7 +7904,7 @@ void ObjectMgr::LoadTrainerSpell()
// calculate learned spell for profession case when stored cast-spell
trainerSpell.learnedSpell = spell;
- for(int i = 0; i <3; ++i)
+ for(uint8 i = 0; i <3; ++i)
{
if(spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
continue;
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 6e5bb98833a..7448d6440ce 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -842,7 +842,7 @@ bool Guardian::InitStatsForLevel(uint32 petlevel)
createResistance[SPELL_SCHOOL_SHADOW] = cinfo->resistance5;
createResistance[SPELL_SCHOOL_ARCANE] = cinfo->resistance6;
}
- for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
+ for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
//health, mana, armor and resistance
@@ -1522,7 +1522,7 @@ bool Pet::resetTalents(bool no_cost)
}
}
- for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
+ for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
{
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
@@ -1632,7 +1632,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if(itr == m_spells.end())
return;
- int i;
+ uint32 i;
if(apply)
{
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index d03aa7af7c4..3960b59d6d4 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -334,7 +334,7 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
if( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
{
data << uint8(1);
- for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
+ for(uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << ((Pet*)pet)->GetDeclinedNames()->name[i];
}
else
@@ -457,7 +457,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
if(isdeclined)
{
- for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
+ for(uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1);
recv_data >> declinedname.name[i];
@@ -475,7 +475,7 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
CharacterDatabase.BeginTransaction();
if(isdeclined)
{
- for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
+ for(uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
CharacterDatabase.escape_string(declinedname.name[i]);
CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 212ada7f450..d82fca25877 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -20519,7 +20519,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
- for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
+ for(uint8 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))
{
@@ -20654,7 +20654,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// find current max talent rank
int32 curtalent_maxrank = 0;
- for(int32 k = MAX_TALENT_RANK-1; k > -1; --k)
+ for(uint8 k = MAX_TALENT_RANK-1; k > -1; --k)
{
if(talentInfo->RankID[k] && pet->HasSpell(talentInfo->RankID[k]))
{
@@ -20844,7 +20844,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
// find max talent rank
int32 curtalent_maxrank = -1;
- for(int32 k = 4; k > -1; --k)
+ for(uint8 k = 4; k > -1; --k)
{
if(talentInfo->RankID[k] && HasSpell(talentInfo->RankID[k]))
{
@@ -20921,7 +20921,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data)
// find max talent rank
int32 curtalent_maxrank = -1;
- for(int32 k = 4; k > -1; --k)
+ for(uint8 k = 4; k > -1; --k)
{
if(talentInfo->RankID[k] && pet->HasSpell(talentInfo->RankID[k]))
{
diff --git a/src/game/Player.h b/src/game/Player.h
index 3d2f876bc3b..111e5def205 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -185,7 +185,7 @@ struct PlayerClassInfo
struct PlayerLevelInfo
{
- PlayerLevelInfo() { for(int i=0; i < MAX_STATS; ++i ) stats[i] = 0; }
+ PlayerLevelInfo() { for(uint8 i=0; i < MAX_STATS; ++i ) stats[i] = 0; }
uint8 stats[MAX_STATS];
};
@@ -330,7 +330,7 @@ struct LookingForGroup
bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry, slot.type); }
bool HaveInSlot(uint32 _entry, uint32 _type) const
{
- for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
if(slots[i].Is(_entry, _type))
return true;
return false;
@@ -338,7 +338,7 @@ struct LookingForGroup
bool canAutoJoin() const
{
- for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
if(slots[i].canAutoJoin())
return true;
return false;
@@ -346,7 +346,7 @@ struct LookingForGroup
bool Empty() const
{
- for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
if(!slots[i].Empty())
return false;
return more.Empty();
@@ -632,7 +632,7 @@ struct EquipmentSet
{
EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW)
{
- for(int i = 0; i < EQUIPMENT_SLOT_END; ++i)
+ for(uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
Items[i] = 0;
}
@@ -1179,7 +1179,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetQuestSlotTimer(uint16 slot,uint32 timer) { SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET,timer); }
void SwapQuestSlot(uint16 slot1,uint16 slot2)
{
- for (int i = 0; i < MAX_QUEST_OFFSET ; ++i )
+ for (uint8 i = 0; i < MAX_QUEST_OFFSET ; ++i )
{
uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i);
uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i);
@@ -1801,7 +1801,7 @@ class TRINITY_DLL_SPEC Player : public Unit
bool InBattleGroundQueue() const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
return true;
return false;
@@ -1810,14 +1810,14 @@ class TRINITY_DLL_SPEC Player : public Unit
BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; }
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return i;
return PLAYER_MAX_BATTLEGROUND_QUEUES;
}
bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return m_bgBattleGroundQueueID[i].invitedToInstance != 0;
return false;
@@ -1834,7 +1834,7 @@ class TRINITY_DLL_SPEC Player : public Unit
}
uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
{
@@ -1847,14 +1847,14 @@ class TRINITY_DLL_SPEC Player : public Unit
}
bool HasFreeBattleGroundQueueId()
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
return true;
return false;
}
void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
{
@@ -1866,13 +1866,13 @@ class TRINITY_DLL_SPEC Player : public Unit
}
void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId)
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
m_bgBattleGroundQueueID[i].invitedToInstance = instanceId;
}
bool IsInvitedForBattleGroundInstance(uint32 instanceId) const
{
- for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
+ for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
return true;
return false;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index edc17b35b19..a4fc30cb2f7 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -1806,7 +1806,7 @@ void Spell::EffectDummy(uint32 i)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
+ for(uint8 j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
{
if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j)))
{
@@ -3409,7 +3409,7 @@ void Spell::EffectSummonType(uint32 i)
if (m_spellInfo->Id == 18662) // Curse of Doom
amount = 1;
- for(int32 count = 0; count < amount; ++count)
+ for(uint32 count = 0; count < amount; ++count)
{
float px, py, pz;
GetSummonPosition(i, px, py, pz, radius, count);
@@ -3823,7 +3823,7 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx)
// support only enchantings with add socket in this slot
{
bool add_socket = false;
- for(int i = 0; i < 3; ++i)
+ for(uint8 i = 0; i < 3; ++i)
{
if(pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET)
{
@@ -4222,7 +4222,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
stack = aur->GetParentAura()->GetStackAmount();
}
- for(int j = 0; j < 3; j++)
+ for(uint8 j = 0; j < 3; j++)
{
if(m_spellInfo->Effect[j] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
{
@@ -4614,7 +4614,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
uint32 spells[4] = { 26272, 26157, 26273, 26274 };
// check presence
- for(int j = 0; j < 4; ++j)
+ for(uint8 j = 0; j < 4; ++j)
if(unitTarget->HasAuraEffect(spells[j],0))
return;
@@ -6213,7 +6213,7 @@ void Spell::EffectSummonDeadPet(uint32 /*i*/)
void Spell::EffectDestroyAllTotems(uint32 /*i*/)
{
int32 mana = 0;
- for(int slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
+ for(uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
{
if(!m_caster->m_SummonSlot[slot])
continue;
@@ -6493,7 +6493,7 @@ void Spell::EffectSummonDemon(uint32 i)
int32 amount = damage > 0 ? damage : 1;
- for(int32 count = 0; count < amount; ++count)
+ for(uint32 count = 0; count < amount; ++count)
{
float px, py, pz;
GetSummonPosition(i, px, py, pz, radius, count);
@@ -6710,7 +6710,7 @@ void Spell::SummonGuardian(uint32 entry, SummonPropertiesEntry const *properties
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Map *map = caster->GetMap();
- for(int32 count = 0; count < amount; ++count)
+ for(uint32 count = 0; count < amount; ++count)
{
float px, py, pz;
GetSummonPosition(0, px, py, pz, radius, count);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b3e113ff6fb..b1946870a26 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -108,7 +108,7 @@ Unit::Unit()
m_addDmgOnce = 0;
- for(int i = 0; i < MAX_SUMMON_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i] = 0;
m_ObjectSlot[0] = m_ObjectSlot[1] = m_ObjectSlot[2] = m_ObjectSlot[3] = 0;
@@ -126,9 +126,9 @@ Unit::Unit()
m_ShapeShiftFormSpellId = 0;
m_canModifyStats = false;
- for (int i = 0; i < MAX_SPELL_IMMUNITY; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
m_spellImmune[i].clear();
- for (int i = 0; i < UNIT_MOD_END; ++i)
+ for (uint8 i = 0; i < UNIT_MOD_END; ++i)
{
m_auraModifiersGroup[i][BASE_VALUE] = 0.0f;
m_auraModifiersGroup[i][BASE_PCT] = 1.0f;
@@ -138,12 +138,12 @@ Unit::Unit()
// implement 50% base damage from offhand
m_auraModifiersGroup[UNIT_MOD_DAMAGE_OFFHAND][TOTAL_PCT] = 0.5f;
- for (int i = 0; i < MAX_ATTACK; ++i)
+ for (uint8 i = 0; i < MAX_ATTACK; ++i)
{
m_weaponDamage[i][MINDAMAGE] = BASE_MINDAMAGE;
m_weaponDamage[i][MAXDAMAGE] = BASE_MAXDAMAGE;
}
- for (int i = 0; i < MAX_STATS; ++i)
+ for (uint8 i = 0; i < MAX_STATS; ++i)
m_createStats[i] = 0.0f;
m_attacking = NULL;
@@ -156,10 +156,10 @@ Unit::Unit()
m_lastManaUse = 0;
//m_victimThreat = 0.0f;
- for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
m_threatModifier[i] = 1.0f;
m_isSorted = true;
- for (int i = 0; i < MAX_MOVE_TYPE; ++i)
+ for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
m_speed_rate[i] = 1.0f;
m_charmInfo = NULL;
@@ -168,7 +168,7 @@ Unit::Unit()
m_misdirectionTargetGUID = 0;
// remove aurastates allowing special moves
- for(int i=0; i < MAX_REACTIVE; ++i)
+ for(uint8 i=0; i < MAX_REACTIVE; ++i)
m_reactiveTimer[i] = 0;
}
@@ -1084,7 +1084,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
SpellCastTargets targets;
uint32 targetMask = spellInfo->Targets;
//if(targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2))
- for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
{
@@ -1156,7 +1156,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit*
uint32 targetMask = spellInfo->Targets;
//check unit target
- for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if(spellmgr.SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET)
{
@@ -1711,7 +1711,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive())
{
- for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
+ for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
{
// If usable, try to cast item spell
if (Item * item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0,i))
@@ -2733,7 +2733,7 @@ int32 Unit::GetMechanicResistChance(const SpellEntry *spell)
if(!spell)
return 0;
int32 resist_mech = 0;
- for(int eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
+ for(uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{
if(spell->Effect[eff] == 0)
break;
@@ -2778,7 +2778,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
// Chance resist mechanic (select max value from every mechanic spell effect)
int32 resist_mech = 0;
// Get effects mechanic and chance
- for(int eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
+ for(uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{
int32 effect_mech = GetEffectMechanic(spell, eff);
if (effect_mech)
@@ -3949,7 +3949,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
bool is_triggered_by_spell = false;
// prevent triggered aura of removing aura that triggered it
- for(int j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for(uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id)
is_triggered_by_spell = true;
@@ -4739,7 +4739,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
data << uint32(overkill < 0 ? 0 : overkill); // Overkill
data << uint8(count); // Sub damage count
- for(int i = 0; i < count; ++i)
+ for(uint32 i = 0; i < count; ++i)
{
data << uint32(damageInfo->damageSchoolMask); // School of sub damage
data << float(damageInfo->damage); // sub damage
@@ -4748,13 +4748,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo)
if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2))
{
- for(int i = 0; i < count; ++i)
+ for(uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->absorb); // Absorb
}
if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2))
{
- for(int i = 0; i < count; ++i)
+ for(uint32 i = 0; i < count; ++i)
data << uint32(damageInfo->resist); // Resist
}
@@ -5746,7 +5746,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
int EffIndex = 0;
- for(int i = 0; i < MAX_SPELL_EFFECTS; i++)
+ for(uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
if(GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
@@ -6338,7 +6338,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 54939:
{
// Lookup base amount mana restore
- for (int i=0; i<MAX_SPELL_EFFECTS;i++)
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;i++)
if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
int32 mana = procSpell->EffectBasePoints[i];
@@ -8472,7 +8472,7 @@ bool Unit::isAttackingPlayer() const
if((*itr)->isAttackingPlayer())
return true;
- for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
if(m_SummonSlot[i])
if(Creature *summon = GetMap()->GetCreature(m_SummonSlot[i]))
if(summon->isAttackingPlayer())
@@ -8683,7 +8683,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
// FIXME: hack, speed must be set only at follow
if(GetTypeId() == TYPEID_PLAYER && minion->HasSummonMask(SUMMON_MASK_PET))
- for(int i = 0; i < MAX_MOVE_TYPE; ++i)
+ for(uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
minion->SetSpeed(UnitMoveType(i), m_speed_rate[i], true);
// Ghoul pets have energy instead of mana (is anywhere better place for this code?)
@@ -9388,7 +9388,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
if(DotDuration > 30000) DotDuration = 30000;
if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f;
int x = 0;
- for(int j = 0; j < MAX_SPELL_EFFECTS; j++)
+ for(uint8 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
@@ -9412,7 +9412,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for(int j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for(uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH )
@@ -9855,8 +9855,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
{
if(DotDuration > 30000) DotDuration = 30000;
if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f;
- int x = 0;
- for(int j = 0; j < MAX_SPELL_EFFECTS; j++)
+ uint32 x = 0;
+ for(uint8 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
@@ -9879,7 +9879,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Distribute Damage over multiple effects, reduce by AoE
CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
// 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for(int j = 0; j < MAX_SPELL_EFFECTS; ++j)
+ for(uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH )
@@ -10551,7 +10551,7 @@ void Unit::ClearInCombat()
{
if(Unit *owner = GetOwner())
{
- for(int i = 0; i < MAX_MOVE_TYPE; ++i)
+ for(uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true);
}
}
@@ -12145,7 +12145,7 @@ void Unit::DeleteCharmInfo()
CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false)
{
- for(int i =0; i<MAX_SPELL_CHARM; ++i)
+ for(uint8 i =0; i<MAX_SPELL_CHARM; ++i)
{
m_charmspells[i].spellId = 0;
m_charmspells[i].active = ACT_DISABLED;
@@ -12345,7 +12345,7 @@ void CharmInfo::LoadPetActionBar(const std::string& data )
if (tokens.size() != (ACTION_BAR_INDEX_PET_SPELL_END-ACTION_BAR_INDEX_PET_SPELL_START)*2)
return; // non critical, will reset to default
- int index;
+ uint8 index;
Tokens::iterator iter;
for(iter = tokens.begin(), index = ACTION_BAR_INDEX_PET_SPELL_START; index < ACTION_BAR_INDEX_PET_SPELL_END; ++iter, ++index )
{
@@ -12376,7 +12376,7 @@ void CharmInfo::BuildActionBar( WorldPacket* data )
void CharmInfo::SetSpellAutocast( uint32 spell_id, bool state )
{
- for(int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
+ for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
if(spell_id == PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell())
{
@@ -12412,7 +12412,7 @@ typedef std::list< ProcTriggeredData > ProcTriggeredList;
// for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic
bool InitTriggerAuraData()
{
- for (int i = 0; i < TOTAL_AURAS; ++i)
+ for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
isTriggerAura[i]=false;
isNonTriggerAura[i] = false;
@@ -13046,7 +13046,7 @@ void Unit::ClearComboPointHolders()
void Unit::ClearAllReactives()
{
- for(int i=0; i < MAX_REACTIVE; ++i)
+ for(uint8 i=0; i < MAX_REACTIVE; ++i)
m_reactiveTimer[i] = 0;
if (HasAuraState( AURA_STATE_DEFENSE))
@@ -13059,7 +13059,7 @@ void Unit::ClearAllReactives()
void Unit::UpdateReactives( uint32 p_time )
{
- for(int i = 0; i < MAX_REACTIVE; ++i)
+ for(uint8 i = 0; i < MAX_REACTIVE; ++i)
{
ReactiveType reactive = ReactiveType(i);
@@ -14531,7 +14531,7 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
if((*itr)->GetTypeId() == TYPEID_UNIT)
(*itr)->SetPhaseMask(newPhaseMask,true);
- for(int8 i = 0; i < MAX_SUMMON_SLOT; ++i)
+ for(uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
if(m_SummonSlot[i])
if(Creature *summon = GetMap()->GetCreature(m_SummonSlot[i]))
summon->SetPhaseMask(newPhaseMask,true);
diff --git a/src/game/Unit.h b/src/game/Unit.h
index ffc4c91f7a8..03a02f0c512 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1436,8 +1436,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply) { ApplyPercentModFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val, apply); }
void InitStatBuffMods()
{
- for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_POSSTAT0+i, 0);
- for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_NEGSTAT0+i, 0);
+ for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_POSSTAT0+i, 0);
+ for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_NEGSTAT0+i, 0);
}
void ApplyStatBuffMod(Stats stat, float val, bool apply) { ApplyModSignedFloatValue((val > 0 ? UNIT_FIELD_POSSTAT0+stat : UNIT_FIELD_NEGSTAT0+stat), val, apply); }
void ApplyStatPercentBuffMod(Stats stat, float val, bool apply)