diff --git a/src/game/AuctionHouse.cpp b/src/game/AuctionHouse.cpp index 11ab1adf9..6f3c75c1c 100644 --- a/src/game/AuctionHouse.cpp +++ b/src/game/AuctionHouse.cpp @@ -576,7 +576,7 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data ) ++count; } } - for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) + for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) { AuctionEntry *Aentry = itr->second; if( Aentry && Aentry->bidder == pl->GetGUIDLow() ) @@ -623,7 +623,7 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data ) uint32 count = 0; uint32 totalcount = 0; - for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) + for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) { AuctionEntry *Aentry = itr->second; if( Aentry && Aentry->owner == _player->GetGUIDLow() ) @@ -689,7 +689,7 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) wstrToLower(wsearchedname); - for (AuctionHouseObject::AuctionEntryMap::iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) + for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = mAuctions->GetAuctionsBegin();itr != mAuctions->GetAuctionsEnd();++itr) { AuctionEntry *Aentry = itr->second; Item *item = objmgr.GetAItem(Aentry->item_guidlow); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 1e03c12cb..298fe2821 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -131,18 +131,19 @@ struct BattleGroundObjectInfo enum BattleGroundTypeId { - BATTLEGROUND_AV = 1, - BATTLEGROUND_WS = 2, - BATTLEGROUND_AB = 3, - BATTLEGROUND_NA = 4, - BATTLEGROUND_BE = 5, - BATTLEGROUND_AA = 6, - BATTLEGROUND_EY = 7, - BATTLEGROUND_RL = 8, - BATTLEGROUND_SA = 9, - BATTLEGROUND_DS = 10, - BATTLEGROUND_RV = 11 + BATTLEGROUND_AV = 1, + BATTLEGROUND_WS = 2, + BATTLEGROUND_AB = 3, + BATTLEGROUND_NA = 4, + BATTLEGROUND_BE = 5, + BATTLEGROUND_AA = 6, + BATTLEGROUND_EY = 7, + BATTLEGROUND_RL = 8, + BATTLEGROUND_SA = 9, + BATTLEGROUND_DS = 10, + BATTLEGROUND_RV = 11 }; +#define MAX_BATTLEGROUND_TYPE_ID 12 // handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time enum BattleGroundQueueTypeId diff --git a/src/game/Creature.h b/src/game/Creature.h index 74c0f238c..157f26821 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -359,14 +359,14 @@ typedef std::list VendorItemCounts; struct TrainerSpell { uint32 spell; - uint32 spellcost; - uint32 reqskill; - uint32 reqskillvalue; - uint32 reqlevel; - uint32 learned_spell; + uint32 spellCost; + uint32 reqSkill; + uint32 reqSkillValue; + uint32 reqLevel; + uint32 learnedSpell; // helpers - bool IsCastable() const { return learned_spell != spell; } + bool IsCastable() const { return learnedSpell != spell; } }; typedef std::vector TrainerSpellList; diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 4cd80d77e..4f72f5bb5 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -265,7 +265,7 @@ void InstanceSaveManager::CleanupInstances() // creature_respawn and gameobject_respawn are in another database // first, obtain total instance set - std::set< uint32 > InstanceSet; + std::set InstanceSet; QueryResult *result = CharacterDatabase.Query("SELECT id FROM instance"); if( result ) { @@ -317,7 +317,7 @@ void InstanceSaveManager::PackInstances() // TODO: this can be done a LOT more efficiently // obtain set of all associations - std::set< uint32 > InstanceSet; + std::set InstanceSet; // all valid ids are in the instance table // any associations to ids not in this table are assumed to be @@ -339,7 +339,7 @@ void InstanceSaveManager::PackInstances() uint32 InstanceNumber = 1; // we do assume std::set is sorted properly on integer value - for (std::set< uint32 >::iterator i = InstanceSet.begin(); i != InstanceSet.end(); ++i) + for (std::set::iterator i = InstanceSet.begin(); i != InstanceSet.end(); ++i) { if (*i != InstanceNumber) { diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 4d1a95150..44985ed3b 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -740,7 +740,7 @@ void WorldSession::SendListInventory( uint64 vendorguid ) float discountMod = _player->GetReputationPriceDiscount(pCreature); - for(int i = 0; i < numitems; i++ ) + for(int i = 0; i < numitems; ++i ) { if(VendorItem const* crItem = vItems->GetItem(i)) { diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 972d0846d..ccc922e9b 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -164,24 +164,24 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) { TrainerSpell const* tSpell = *itr; - if(!_player->IsSpellFitByClassAndRace(tSpell->learned_spell)) + if(!_player->IsSpellFitByClassAndRace(tSpell->learnedSpell)) continue; ++count; - bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learned_spell); + bool primary_prof_first_rank = spellmgr.IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell); - SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(tSpell->learned_spell); + SpellChainNode const* chain_node = spellmgr.GetSpellChainNode(tSpell->learnedSpell); data << uint32(tSpell->spell); // learned spell (or cast-spell in profession case) data << uint8(_player->GetTrainerSpellState(tSpell)); - data << uint32(floor(tSpell->spellcost * fDiscountMod)); + data << uint32(floor(tSpell->spellCost * fDiscountMod)); data << uint32(primary_prof_first_rank ? 1 : 0); // primary prof. learn confirmation dialog data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state - data << uint8(tSpell->reqlevel); - data << uint32(tSpell->reqskill); - data << uint32(tSpell->reqskillvalue); + data << uint8(tSpell->reqLevel); + data << uint32(tSpell->reqSkill); + data << uint32(tSpell->reqSkillValue); data << uint32(chain_node ? (chain_node->prev ? chain_node->prev : chain_node->req) : 0); data << uint32(chain_node && chain_node->prev ? chain_node->req : 0); data << uint32(0); @@ -232,7 +232,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data ) return; // apply reputation discount - uint32 nSpellCost = uint32(floor(trainer_spell->spellcost * _player->GetReputationPriceDiscount(unit))); + uint32 nSpellCost = uint32(floor(trainer_spell->spellCost * _player->GetReputationPriceDiscount(unit))); // check money requirement if(_player->GetMoney() < nSpellCost ) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index dc4150511..2b6703abd 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -43,6 +43,7 @@ #include "SpellAuras.h" #include "Util.h" #include "WaypointManager.h" +#include "BattleGround.h" INSTANTIATE_SINGLETON_1(ObjectMgr); @@ -6578,6 +6579,11 @@ void ObjectMgr::LoadBattleMastersEntry() uint32 entry = fields[0].GetUInt32(); uint32 bgTypeId = fields[1].GetUInt32(); + if (bgTypeId >= MAX_BATTLEGROUND_TYPE_ID) + { + sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); + continue; + } mBattleMastersMap[entry] = bgTypeId; @@ -7274,16 +7280,16 @@ void ObjectMgr::LoadTrainerSpell() TrainerSpell* pTrainerSpell = new TrainerSpell(); pTrainerSpell->spell = spell; - pTrainerSpell->spellcost = fields[2].GetUInt32(); - pTrainerSpell->reqskill = fields[3].GetUInt32(); - pTrainerSpell->reqskillvalue = fields[4].GetUInt32(); - pTrainerSpell->reqlevel = fields[5].GetUInt32(); + pTrainerSpell->spellCost = fields[2].GetUInt32(); + pTrainerSpell->reqSkill = fields[3].GetUInt32(); + pTrainerSpell->reqSkillValue = fields[4].GetUInt32(); + pTrainerSpell->reqLevel = fields[5].GetUInt32(); - if(!pTrainerSpell->reqlevel) - pTrainerSpell->reqlevel = spellinfo->spellLevel; + if(!pTrainerSpell->reqLevel) + pTrainerSpell->reqLevel = spellinfo->spellLevel; // calculate learned spell for profession case when stored cast-spell - pTrainerSpell->learned_spell = spell; + pTrainerSpell->learnedSpell = spell; for(int i = 0; i <3; ++i) { if(spellinfo->Effect[i]!=SPELL_EFFECT_LEARN_SPELL) @@ -7291,7 +7297,7 @@ void ObjectMgr::LoadTrainerSpell() if(SpellMgr::IsProfessionOrRidingSpell(spellinfo->EffectTriggerSpell[i])) { - pTrainerSpell->learned_spell = spellinfo->EffectTriggerSpell[i]; + pTrainerSpell->learnedSpell = spellinfo->EffectTriggerSpell[i]; break; } } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b986f2a51..80947f947 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3553,22 +3553,22 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell if (!trainer_spell) return TRAINER_SPELL_RED; - if (!trainer_spell->learned_spell) + if (!trainer_spell->learnedSpell) return TRAINER_SPELL_RED; // known spell - if(HasSpell(trainer_spell->learned_spell)) + if(HasSpell(trainer_spell->learnedSpell)) return TRAINER_SPELL_GRAY; // check race/class requirement - if(!IsSpellFitByClassAndRace(trainer_spell->learned_spell)) + if(!IsSpellFitByClassAndRace(trainer_spell->learnedSpell)) return TRAINER_SPELL_RED; // check level requirement - if(getLevel() < trainer_spell->reqlevel) + if(getLevel() < trainer_spell->reqLevel) return TRAINER_SPELL_RED; - if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->learned_spell)) + if(SpellChainNode const* spell_chain = spellmgr.GetSpellChainNode(trainer_spell->learnedSpell)) { // check prev.rank requirement if(spell_chain->prev && !HasSpell(spell_chain->prev)) @@ -3580,11 +3580,11 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell } // check skill requirement - if(trainer_spell->reqskill && GetBaseSkillValue(trainer_spell->reqskill) < trainer_spell->reqskillvalue) + if(trainer_spell->reqSkill && GetBaseSkillValue(trainer_spell->reqSkill) < trainer_spell->reqSkillValue) return TRAINER_SPELL_RED; // exist, already checked at loading - SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->learned_spell); + SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->learnedSpell); // secondary prof. or not prof. spell uint32 skill = spell->EffectMiscValue[1]; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7f988ece3..b4ae24781 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7247" + #define REVISION_NR "7248" #endif // __REVISION_NR_H__