diff options
author | Machiavelli <none@none> | 2009-06-18 21:34:21 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-06-18 21:34:21 +0200 |
commit | 9fd90319187d7ecf6c992d3ba33d08d8810ca46d (patch) | |
tree | 576ff815ba3830c267dbac3f7e224f97d28d8c6b /src | |
parent | 55301804d29977c7cd5502cba5d6d270dbe6d10f (diff) |
* More updating of iterator data types in loops. (Player.cpp fully done now)
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3c6356c7c00..3e563050856 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -140,7 +140,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 leve { case CLASS_DEATH_KNIGHT: { - for(int i = 0; i < TaxiMaskSize; ++i) + for(uint8 i = 0; i < TaxiMaskSize; ++i) m_taximask[i] |= sOldContinentsNodesMask[i]; break; } @@ -177,7 +177,7 @@ void PlayerTaxi::LoadTaxiMask(const char* data) { Tokens tokens = StrSplit(data, " "); - int index; + uint8 index; Tokens::iterator iter; for (iter = tokens.begin(), index = 0; (index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index) @@ -265,7 +265,7 @@ uint32 PlayerTaxi::GetCurrentTaxiPath() const std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi) { ss << "'"; - for(int i = 0; i < TaxiMaskSize; ++i) + for(uint8 i = 0; i < TaxiMaskSize; ++i) ss << taxi.m_taximask[i] << " "; ss << "'"; return ss; @@ -352,7 +352,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_DailyQuestChanged = false; m_lastDailyQuestTime = 0; - for (int i=0; i<MAX_TIMERS; i++) + for (uint8 i=0; i<MAX_TIMERS; i++) m_MirrorTimer[i] = DISABLED_MIRROR_TIMER; m_MirrorTimerFlags = UNDERWATER_NONE; @@ -412,7 +412,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_resetTalentsTime = 0; m_itemUpdateQueueBlocked = false; - for (int i = 0; i < MAX_MOVE_TYPE; ++i) + for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) m_forced_speed_changes[i] = 0; m_stableSlots = 0; @@ -428,13 +428,13 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_activeSpec = 0; m_specsCount = 0; - for (int i = 0; i < BASEMOD_END; ++i) + for (uint8 i = 0; i < BASEMOD_END; ++i) { m_auraBaseMod[i][FLAT_MOD] = 0.0f; m_auraBaseMod[i][PCT_MOD] = 1.0f; } - for (int i = 0; i < MAX_COMBAT_RATING; i++) + for (uint8 i = 0; i < MAX_COMBAT_RATING; i++) m_baseRatingValue[i] = 0; m_baseSpellDamage = 0; @@ -479,7 +479,7 @@ Player::~Player () //m_social = NULL; // Note: buy back item already deleted from DB when player was saved - for(int i = 0; i < PLAYER_SLOTS_COUNT; ++i) + for(uint8 i = 0; i < PLAYER_SLOTS_COUNT; ++i) { if(m_items[i]) delete m_items[i]; @@ -536,7 +536,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 return false; } - for (int i = 0; i < PLAYER_SLOTS_COUNT; i++) + for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++) m_items[i] = NULL; m_race = race; @@ -708,18 +708,18 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // original action bar std::list<uint16>::const_iterator action_itr[4]; - for(int i=0; i<4; i++) + for(uint8 i=0; i<4; i++) action_itr[i] = info->action[i].begin(); for (; action_itr[0]!=info->action[0].end() && action_itr[1]!=info->action[1].end();) { uint16 taction[4]; - for(int i=0; i<4 ;i++) + for(uint8 i=0; i<4 ;i++) taction[i] = (*action_itr[i]); addActionButton((uint8)taction[0], taction[1], (uint8)taction[2], (uint8)taction[3]); - for(int i=0; i<4 ;i++) + for(uint8 i=0; i<4 ;i++) ++action_itr[i]; } @@ -786,7 +786,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // bags and main-hand weapon must equipped at this moment // now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon) // or ammo not equipped in special bag - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { if(Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -1064,7 +1064,7 @@ void Player::HandleDrowning(uint32 time_diff) // Recheck timers flag m_MirrorTimerFlags&=~UNDERWATER_EXIST_TIMERS; - for (int i = 0; i< MAX_TIMERS; ++i) + for (uint8 i = 0; i< MAX_TIMERS; ++i) if (m_MirrorTimer[i]!=DISABLED_MIRROR_TIMER) { m_MirrorTimerFlags|=UNDERWATER_EXIST_TIMERS; @@ -1820,7 +1820,7 @@ void Player::AddToWorld() ///- The player should only be added when logging in Unit::AddToWorld(); - for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) + for(uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(m_items[i]) m_items[i]->AddToWorld(); @@ -1843,7 +1843,7 @@ void Player::RemoveFromWorld() ///- The player should only be removed when logging out Unit::RemoveFromWorld(); - for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) + for(uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(m_items[i]) m_items[i]->RemoveFromWorld(); @@ -2363,7 +2363,7 @@ void Player::GiveLevel(uint32 level) data << uint32(0); data << uint32(0); // end for - for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4) + for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4) data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i))); GetSession()->SendPacket(&data); @@ -2377,7 +2377,7 @@ void Player::GiveLevel(uint32 level) UpdateSkillsForLevel (); // save base values (bonuses already included in stored stats - for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) + for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetCreateStat(Stats(i), info.stats[i]); SetCreateHealth(classInfo.basehealth); @@ -2464,10 +2464,10 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(OBJECT_FIELD_SCALE_X,1.0f); // save base values (bonuses already included in stored stats - for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) + for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetCreateStat(Stats(i), info.stats[i]); - for(int i = STAT_STRENGTH; i < MAX_STATS; ++i) + for(uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetStat(Stats(i), info.stats[i]); SetCreateHealth(classInfo.basehealth); @@ -2484,7 +2484,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(index, 0); SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS,0); - for (int i = 0; i < 7; i++) + for (uint8 i = 0; i < 7; i++) { SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0); SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, 0); @@ -2531,7 +2531,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetResistanceBuffMods(SpellSchools(0), true, 0.0f); SetResistanceBuffMods(SpellSchools(0), false, 0.0f); // set other resistance to original value (0) - for (int i = 1; i < MAX_SPELL_SCHOOL; i++) + for (uint8 i = 1; i < MAX_SPELL_SCHOOL; i++) { SetResistance(SpellSchools(i), 0); SetResistanceBuffMods(SpellSchools(i), true, 0.0f); @@ -2540,19 +2540,19 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,0); SetUInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,0); - for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) + for(uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i) { SetUInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,0); SetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,0.0f); } // Reset no reagent cost field - for(int i = 0; i < 3; i++) + for(uint8 i = 0; i < 3; i++) SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + i, 0); // Init data for form but skip reapply item mods for form InitDataForForm(reapplyMods); // save new stats - for (int i = POWER_MANA; i < MAX_POWERS; i++) + for (uint8 i = POWER_MANA; i < MAX_POWERS; i++) SetMaxPower(Powers(i), uint32(GetCreatePowers(Powers(i)))); SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later @@ -2888,7 +2888,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 < MAX_TALENT_RANK; ++i) + for(uint8 i=0; i < MAX_TALENT_RANK; ++i) { // skip learning spell and no rank spell case uint32 rankSpellId = talentInfo->RankID[i]; @@ -3553,7 +3553,7 @@ bool Player::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); @@ -3746,9 +3746,9 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(i); // Players visible items are not inventory stuff - for(uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i) + for(uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) { - uint32 offset = i * 2; + uint16 offset = i * 2; // item entry updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENTRYID + offset); @@ -3761,7 +3761,7 @@ void Player::InitVisibleBits() void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const { - for(int i = 0; i < EQUIPMENT_SLOT_END; i++) + for(uint8 i = 0; i < EQUIPMENT_SLOT_END; i++) { if(m_items[i] == NULL) continue; @@ -3771,14 +3771,14 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) if(target == this) { - for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { if(m_items[i] == NULL) continue; m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { if(m_items[i] == NULL) continue; @@ -3794,7 +3794,7 @@ void Player::DestroyForPlayer( Player *target ) const { Unit::DestroyForPlayer( target ); - for(int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i] == NULL) continue; @@ -3804,14 +3804,14 @@ void Player::DestroyForPlayer( Player *target ) const if(target == this) { - for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { if(m_items[i] == NULL) continue; m_items[i]->DestroyForPlayer( target ); } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { if(m_items[i] == NULL) continue; @@ -4266,7 +4266,7 @@ void Player::CreateCorpse() uint32 iDisplayID; uint16 iIventoryType; uint32 _cfi; - for (int i = 0; i < EQUIPMENT_SLOT_END; i++) + for (uint8 i = 0; i < EQUIPMENT_SLOT_END; i++) { if(m_items[i]) { @@ -4301,7 +4301,7 @@ Corpse* Player::GetCorpse() const void Player::DurabilityLossAll(double percent, bool inventory) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityLoss(pItem,percent); @@ -4310,14 +4310,14 @@ void Player::DurabilityLossAll(double percent, bool inventory) // bags not have durability // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityLoss(pItem,percent); // keys not have durability //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) for(uint32 j = 0; j < pBag->GetBagSize(); j++) if(Item* pItem = GetItemByPos( i, j )) @@ -4345,7 +4345,7 @@ void Player::DurabilityLoss(Item* item, double percent) void Player::DurabilityPointsLossAll(int32 points, bool inventory) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityPointsLoss(pItem,points); @@ -4354,14 +4354,14 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory) // bags not have durability // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityPointsLoss(pItem,points); // keys not have durability //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) for(uint32 j = 0; j < pBag->GetBagSize(); j++) if(Item* pItem = GetItemByPos( i, j )) @@ -4406,14 +4406,14 @@ uint32 Player::DurabilityRepairAll(bool cost, float discountMod, bool guildBank) { uint32 TotalCost = 0; // equipped, backpack, bags itself - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) TotalCost += DurabilityRepair(( (INVENTORY_SLOT_BAG_0 << 8) | i ),cost,discountMod, guildBank); // bank, buyback and keys not repaired // items in inventory bags - for(int j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; j++) - for(int i = 0; i < MAX_BAG_SIZE; i++) + for(uint8 j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; j++) + for(uint8 i = 0; i < MAX_BAG_SIZE; i++) TotalCost += DurabilityRepair(( (j << 8) | i ),cost,discountMod, guildBank); return TotalCost; } @@ -5010,7 +5010,7 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) void Player::SetRegularAttackTime() { - for(int i = 0; i < MAX_ATTACK; ++i) + for(uint8 i = 0; i < MAX_ATTACK; ++i) { Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i)); if(tmpitem && !tmpitem->IsBroken()) @@ -5524,7 +5524,7 @@ int16 Player::GetSkillPermBonusValue(uint32 skill) const if(!skill) return 0; - for (int i = 0; i < PLAYER_MAX_SKILLS; i++) + for (uint8 i = 0; i < PLAYER_MAX_SKILLS; i++) { if ((GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF) == skill) { @@ -5540,7 +5540,7 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const if(!skill) return 0; - for (int i = 0; i < PLAYER_MAX_SKILLS; i++) + for (uint8 i = 0; i < PLAYER_MAX_SKILLS; i++) { if ((GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF) == skill) { @@ -5934,7 +5934,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) void Player::RewardReputation(Quest const *pQuest) { // quest reputation reward/loss - for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + for(uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) { if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] ) { @@ -6569,7 +6569,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : 0; ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : 0; - for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i) + for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i) { uint32 statType = 0; int32 val = 0; @@ -6922,7 +6922,7 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change) if(!proto) return; - for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { _Spell const& spellData = proto->Spells[i]; @@ -6981,7 +6981,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply void Player::UpdateEquipSpellsAtFormChange() { - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i] && !m_items[i]->IsBroken()) { @@ -7209,7 +7209,7 @@ void Player::_RemoveAllItemMods() { sLog.outDebug("_RemoveAllItemMods start."); - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i]) { @@ -7229,7 +7229,7 @@ void Player::_RemoveAllItemMods() } } - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i]) { @@ -7257,7 +7257,7 @@ void Player::_ApplyAllItemMods() { sLog.outDebug("_ApplyAllItemMods start."); - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i]) { @@ -7279,7 +7279,7 @@ void Player::_ApplyAllItemMods() } } - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++) { if(m_items[i]) { @@ -8436,7 +8436,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap { if( swap || !GetItemByPos( INVENTORY_SLOT_BAG_0, slot ) ) { - for (int i = 0; i < 4; i++) + for (uint8 i = 0; i < 4; i++) { if ( slots[i] == slot ) return slot; @@ -8446,7 +8446,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap else { // search free slot at first - for (int i = 0; i < 4; i++) + for (uint8 i = 0; i < 4; i++) { if ( slots[i] != NULL_SLOT && !GetItemByPos( INVENTORY_SLOT_BAG_0, slots[i] ) ) { @@ -8457,7 +8457,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap } // if not found free and can swap return first appropriate from used - for (int i = 0; i < 4; i++) + for (uint8 i = 0; i < 4; i++) { if ( slots[i] != NULL_SLOT && swap ) return slots[i]; @@ -8475,7 +8475,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const uint8 res = EQUIP_ERR_OK; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8491,7 +8491,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const res = ires; } } - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8501,7 +8501,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const return EQUIP_ERR_OK; } } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8512,7 +8512,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const } } Bag *pBag; - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8537,19 +8537,19 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) const { uint32 count = 0; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8558,7 +8558,7 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(skipItem && skipItem->GetProto()->GemProperties) { - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetProto()->Socket[0].Color ) @@ -8568,13 +8568,13 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(inBankAlso) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) { Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8583,7 +8583,7 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(skipItem && skipItem->GetProto()->GemProperties) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) { Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetProto()->Socket[0].Color ) @@ -8597,20 +8597,20 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons Item* Player::GetItemByGuid( uint64 guid ) const { - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetGUID() == guid ) return pItem; } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetGUID() == guid ) return pItem; } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8623,7 +8623,7 @@ Item* Player::GetItemByGuid( uint64 guid ) const } } } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8830,7 +8830,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot ) bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const { uint32 tempcount = 0; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8840,7 +8840,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + for(uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8850,7 +8850,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -8869,7 +8869,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const if(inBankAlso) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8879,7 +8879,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -8903,9 +8903,9 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot ) const { uint32 tempcount = 0; - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) + for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { - if(i==int(except_slot)) + if(i == except_slot) continue; Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -8920,9 +8920,9 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except ItemPrototype const *pProto = objmgr.GetItemPrototype(item); if (pProto && pProto->GemProperties) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) + for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { - if(i==int(except_slot)) + if(i == except_slot) continue; Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -8941,9 +8941,9 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except bool Player::HasItemOrGemWithLimitCategoryEquipped( uint32 limitCategory, uint32 count, uint8 except_slot ) const { uint32 tempcount = 0; - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) + for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { - if(i==int(except_slot)) + if(i == except_slot) continue; Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9508,7 +9508,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 if( pProto->BagFamily ) { - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9526,7 +9526,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9589,7 +9589,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -20543,7 +20543,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 < MAX_TALENT_RANK; i++) + for (uint32 i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++) { if (depTalentInfo->RankID[i] != 0) if (HasSpell(depTalentInfo->RankID[i])) @@ -20560,8 +20560,8 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sTalentStore.GetNumRows(); - for (unsigned int i = 0; i < numRows; i++) // Loop through all talents. + uint32 numRows = sTalentStore.GetNumRows(); + for (uint32 i = 0; i < numRows; i++) // Loop through all talents. { // Someday, someone needs to revamp const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); @@ -20678,7 +20678,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 < MAX_TALENT_RANK; i++) + for (uint32 i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++) { if (depTalentInfo->RankID[i] != 0) if (pet->HasSpell(depTalentInfo->RankID[i])) @@ -20695,8 +20695,8 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) uint32 tTab = talentInfo->TalentTab; if (talentInfo->Row > 0) { - unsigned int numRows = sTalentStore.GetNumRows(); - for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. + uint32 numRows = sTalentStore.GetNumRows(); + for (uint32 i = 0; i < numRows; ++i) // Loop through all talents. { // Someday, someone needs to revamp const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); |