mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10594] Use equal_range instead of lower_bound/upper_bound pairs
(based on zergtmn's repo commit 0499169) Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
0caa0e32dd
commit
2fa5fa43bd
13 changed files with 207 additions and 182 deletions
|
|
@ -2421,9 +2421,8 @@ void AchievementGlobalMgr::LoadRewards()
|
|||
// GENDER_NONE must be single (so or already in and none must be attempt added new data or just adding and none in)
|
||||
// other duplicate cases prevented by DB primary key
|
||||
bool dup = false;
|
||||
AchievementRewards::const_iterator iter_low = m_achievementRewards.lower_bound(entry);
|
||||
AchievementRewards::const_iterator iter_up = m_achievementRewards.upper_bound(entry);
|
||||
for (AchievementRewards::const_iterator iter = iter_low; iter != iter_up; ++iter)
|
||||
AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(entry);
|
||||
for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
{
|
||||
if (iter->second.gender == GENDER_NONE || reward.gender == GENDER_NONE)
|
||||
{
|
||||
|
|
@ -2495,7 +2494,7 @@ void AchievementGlobalMgr::LoadRewards()
|
|||
}
|
||||
}
|
||||
|
||||
m_achievementRewards.insert(AchievementRewards::value_type(entry,reward));
|
||||
m_achievementRewards.insert(AchievementRewardsMap::value_type(entry, reward));
|
||||
++count;
|
||||
|
||||
} while (result->NextRow());
|
||||
|
|
@ -2548,9 +2547,8 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
|||
// GENDER_NONE must be single (so or already in and none must be attempt added new data or just adding and none in)
|
||||
// other duplicate cases prevented by DB primary key
|
||||
bool dup = false;
|
||||
AchievementRewardLocales::const_iterator iter_low = m_achievementRewardLocales.lower_bound(entry);
|
||||
AchievementRewardLocales::const_iterator iter_up = m_achievementRewardLocales.upper_bound(entry);
|
||||
for (AchievementRewardLocales::const_iterator iter = iter_low; iter != iter_up; ++iter)
|
||||
AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(entry);
|
||||
for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
{
|
||||
if (iter->second.gender == GENDER_NONE || data.gender == GENDER_NONE)
|
||||
{
|
||||
|
|
@ -2590,7 +2588,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
|||
}
|
||||
}
|
||||
|
||||
m_achievementRewardLocales.insert(AchievementRewardLocales::value_type(entry,data));
|
||||
m_achievementRewardLocales.insert(AchievementRewardLocalesMap::value_type(entry, data));
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,8 @@ struct AchievementReward
|
|||
std::string text;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32,AchievementReward> AchievementRewards;
|
||||
typedef std::multimap<uint32, AchievementReward> AchievementRewardsMap;
|
||||
typedef std::pair<AchievementRewardsMap::const_iterator, AchievementRewardsMap::const_iterator> AchievementRewardsMapBounds;
|
||||
|
||||
struct AchievementRewardLocale
|
||||
{
|
||||
|
|
@ -221,8 +222,8 @@ struct AchievementRewardLocale
|
|||
std::vector<std::string> text;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32,AchievementRewardLocale> AchievementRewardLocales;
|
||||
|
||||
typedef std::multimap<uint32, AchievementRewardLocale> AchievementRewardLocalesMap;
|
||||
typedef std::pair<AchievementRewardLocalesMap::const_iterator, AchievementRewardLocalesMap::const_iterator> AchievementRewardLocalesMapBounds;
|
||||
|
||||
struct CompletedAchievementData
|
||||
{
|
||||
|
|
@ -311,9 +312,8 @@ class AchievementGlobalMgr
|
|||
|
||||
AchievementReward const* GetAchievementReward(AchievementEntry const* achievement, uint8 gender) const
|
||||
{
|
||||
AchievementRewards::const_iterator iter_low = m_achievementRewards.lower_bound(achievement->ID);
|
||||
AchievementRewards::const_iterator iter_up = m_achievementRewards.upper_bound(achievement->ID);
|
||||
for (AchievementRewards::const_iterator iter = iter_low; iter != iter_up; ++iter)
|
||||
AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(achievement->ID);
|
||||
for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
if(iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
||||
return &iter->second;
|
||||
|
||||
|
|
@ -322,9 +322,8 @@ class AchievementGlobalMgr
|
|||
|
||||
AchievementRewardLocale const* GetAchievementRewardLocale(AchievementEntry const* achievement, uint8 gender) const
|
||||
{
|
||||
AchievementRewardLocales::const_iterator iter_low = m_achievementRewardLocales.lower_bound(achievement->ID);
|
||||
AchievementRewardLocales::const_iterator iter_up = m_achievementRewardLocales.upper_bound(achievement->ID);
|
||||
for (AchievementRewardLocales::const_iterator iter = iter_low; iter != iter_up; ++iter)
|
||||
AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(achievement->ID);
|
||||
for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
if(iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
||||
return &iter->second;
|
||||
|
||||
|
|
@ -366,8 +365,8 @@ class AchievementGlobalMgr
|
|||
typedef std::set<uint32> AllCompletedAchievements;
|
||||
AllCompletedAchievements m_allCompletedAchievements;
|
||||
|
||||
AchievementRewards m_achievementRewards;
|
||||
AchievementRewardLocales m_achievementRewardLocales;
|
||||
AchievementRewardsMap m_achievementRewards;
|
||||
AchievementRewardLocalesMap m_achievementRewardLocales;
|
||||
};
|
||||
|
||||
#define sAchievementMgr MaNGOS::Singleton<AchievementGlobalMgr>::Instance()
|
||||
|
|
|
|||
|
|
@ -1290,10 +1290,10 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
|
|||
|
||||
bool Creature::hasQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelations const& qr = sObjectMgr.mCreatureQuestRelations;
|
||||
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if(itr->second==quest_id)
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1301,10 +1301,10 @@ bool Creature::hasQuest(uint32 quest_id) const
|
|||
|
||||
bool Creature::hasInvolvedQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelations const& qr = sObjectMgr.mCreatureQuestInvolvedRelations;
|
||||
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if(itr->second == quest_id)
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -795,16 +795,15 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate)
|
|||
QuestRelList::iterator itr;
|
||||
for (itr = mGameEventQuests[event_id].begin();itr != mGameEventQuests[event_id].end();++itr)
|
||||
{
|
||||
QuestRelations &CreatureQuestMap = sObjectMgr.mCreatureQuestRelations;
|
||||
QuestRelationsMap &CreatureQuestMap = sObjectMgr.GetCreatureQuestRelationsMap();
|
||||
|
||||
if (Activate) // Add the pair(id,quest) to the multimap
|
||||
CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
|
||||
CreatureQuestMap.insert(QuestRelationsMap::value_type(itr->first, itr->second));
|
||||
else
|
||||
{ // Remove the pair(id,quest) from the multimap
|
||||
QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first);
|
||||
if (qitr == CreatureQuestMap.end())
|
||||
continue;
|
||||
QuestRelations::iterator lastElement = CreatureQuestMap.upper_bound(itr->first);
|
||||
for ( ;qitr != lastElement;++qitr)
|
||||
std::pair<QuestRelationsMap::iterator, QuestRelationsMap::iterator> bounds = CreatureQuestMap.equal_range(itr->first);
|
||||
|
||||
for(QuestRelationsMap::iterator qitr = bounds.first; qitr != bounds.second; ++qitr)
|
||||
{
|
||||
if (qitr->second == itr->second)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -631,10 +631,10 @@ GameObjectInfo const *GameObject::GetGOInfo() const
|
|||
/*********************************************************/
|
||||
bool GameObject::hasQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelations const& qr = sObjectMgr.mGOQuestRelations;
|
||||
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if(itr->second==quest_id)
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -642,10 +642,10 @@ bool GameObject::hasQuest(uint32 quest_id) const
|
|||
|
||||
bool GameObject::hasInvolvedQuest(uint32 quest_id) const
|
||||
{
|
||||
QuestRelations const& qr = sObjectMgr.mGOQuestInvolvedRelations;
|
||||
for(QuestRelations::const_iterator itr = qr.lower_bound(GetEntry()); itr != qr.upper_bound(GetEntry()); ++itr)
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry());
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if(itr->second==quest_id)
|
||||
if (itr->second == quest_id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -732,9 +732,9 @@ bool GameObject::ActivateToQuest(Player *pTarget)const
|
|||
// these conditions are not sufficient/will fail.
|
||||
// Never expect flags|4 for these GO's? (NF-note: It doesn't appear it's expected)
|
||||
|
||||
const QuestRelations &qRel = sObjectMgr.mGOQuestRelations;
|
||||
QuestRelationsMapBounds bounds = sObjectMgr.GetGOQuestRelationsMapBounds(GetEntry());
|
||||
|
||||
for(QuestRelations::const_iterator itr = qRel.lower_bound(GetEntry()); itr != qRel.upper_bound(GetEntry()); ++itr)
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
const Quest *qInfo = sObjectMgr.GetQuestTemplate(itr->second);
|
||||
|
||||
|
|
@ -742,9 +742,9 @@ bool GameObject::ActivateToQuest(Player *pTarget)const
|
|||
return true;
|
||||
}
|
||||
|
||||
const QuestRelations &qInRel = sObjectMgr.mGOQuestInvolvedRelations;
|
||||
bounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(GetEntry());
|
||||
|
||||
for(QuestRelations::const_iterator itr = qInRel.lower_bound(GetEntry()); itr != qInRel.upper_bound(GetEntry()); ++itr)
|
||||
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if ((pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_INCOMPLETE || pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_COMPLETE)
|
||||
&& !pTarget->GetQuestRewardStatus(itr->second))
|
||||
|
|
|
|||
|
|
@ -936,7 +936,9 @@ uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
|
|||
{
|
||||
uint32 modelId = 0;
|
||||
|
||||
for(CreatureModelRaceMap::const_iterator itr = m_mCreatureModelRaceMap.lower_bound(sourceModelId); itr != m_mCreatureModelRaceMap.upper_bound(sourceModelId); ++itr)
|
||||
CreatureModelRaceMapBounds bounds = m_mCreatureModelRaceMap.equal_range(sourceModelId);
|
||||
|
||||
for(CreatureModelRaceMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (!(itr->second.racemask & racemask))
|
||||
continue;
|
||||
|
|
@ -3551,9 +3553,10 @@ void ObjectMgr::LoadQuests()
|
|||
// For reload case
|
||||
for(QuestMap::const_iterator itr=mQuestTemplates.begin(); itr != mQuestTemplates.end(); ++itr)
|
||||
delete itr->second;
|
||||
|
||||
mQuestTemplates.clear();
|
||||
|
||||
mExclusiveQuestGroups.clear();
|
||||
m_ExclusiveQuestGroups.clear();
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, SkillOrClass, MinLevel, QuestLevel, Type, RequiredRaces, RequiredSkillValue,"
|
||||
|
|
@ -4184,7 +4187,8 @@ void ObjectMgr::LoadQuests()
|
|||
}
|
||||
|
||||
if (qinfo->ExclusiveGroup)
|
||||
mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
|
||||
m_ExclusiveQuestGroups.insert(ExclusiveQuestGroupsMap::value_type(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
|
||||
|
||||
if (qinfo->LimitTime)
|
||||
qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED);
|
||||
}
|
||||
|
|
@ -5779,9 +5783,9 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|||
// then check faction
|
||||
// if mapId != graveyard.mapId (ghost in instance) and search any graveyard associated
|
||||
// then check faction
|
||||
GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
|
||||
GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
|
||||
if(graveLow==graveUp)
|
||||
GraveYardMapBounds bounds = mGraveYardMap.equal_range(zoneId);
|
||||
|
||||
if (bounds.first == bounds.second)
|
||||
{
|
||||
sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team);
|
||||
return NULL;
|
||||
|
|
@ -5802,7 +5806,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(MapId);
|
||||
|
||||
for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
||||
for(GraveYardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
GraveYardData const& data = itr->second;
|
||||
|
||||
|
|
@ -5880,14 +5884,13 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|||
return entryFar;
|
||||
}
|
||||
|
||||
GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId)
|
||||
GraveYardData const* ObjectMgr::FindGraveYardData(uint32 id, uint32 zoneId) const
|
||||
{
|
||||
GraveYardMap::const_iterator graveLow = mGraveYardMap.lower_bound(zoneId);
|
||||
GraveYardMap::const_iterator graveUp = mGraveYardMap.upper_bound(zoneId);
|
||||
GraveYardMapBounds bounds = mGraveYardMap.equal_range(zoneId);
|
||||
|
||||
for(GraveYardMap::const_iterator itr = graveLow; itr != graveUp; ++itr)
|
||||
for(GraveYardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if(itr->second.safeLocId==id)
|
||||
if (itr->second.safeLocId == id)
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -7371,7 +7374,7 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_
|
|||
cell_guids.corpses.erase(player_guid);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map,char const* table)
|
||||
void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table)
|
||||
{
|
||||
map.clear(); // need for reload case
|
||||
|
||||
|
|
@ -7406,7 +7409,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map,char const* table)
|
|||
continue;
|
||||
}
|
||||
|
||||
map.insert(QuestRelations::value_type(id,quest));
|
||||
map.insert(QuestRelationsMap::value_type(id, quest));
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
|
@ -7419,56 +7422,56 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map,char const* table)
|
|||
|
||||
void ObjectMgr::LoadGameobjectQuestRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(mGOQuestRelations,"gameobject_questrelation");
|
||||
LoadQuestRelationsHelper(m_GOQuestRelations, "gameobject_questrelation");
|
||||
|
||||
for(QuestRelations::iterator itr = mGOQuestRelations.begin(); itr != mGOQuestRelations.end(); ++itr)
|
||||
for(QuestRelationsMap::iterator itr = m_GOQuestRelations.begin(); itr != m_GOQuestRelations.end(); ++itr)
|
||||
{
|
||||
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
|
||||
if(!goInfo)
|
||||
if (!goInfo)
|
||||
sLog.outErrorDb("Table `gameobject_questrelation` have data for nonexistent gameobject entry (%u) and existing quest %u",itr->first,itr->second);
|
||||
else if(goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
sLog.outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER",itr->first,itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjectInvolvedRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(mGOQuestInvolvedRelations,"gameobject_involvedrelation");
|
||||
LoadQuestRelationsHelper(m_GOQuestInvolvedRelations, "gameobject_involvedrelation");
|
||||
|
||||
for(QuestRelations::iterator itr = mGOQuestInvolvedRelations.begin(); itr != mGOQuestInvolvedRelations.end(); ++itr)
|
||||
for(QuestRelationsMap::iterator itr = m_GOQuestInvolvedRelations.begin(); itr != m_GOQuestInvolvedRelations.end(); ++itr)
|
||||
{
|
||||
GameObjectInfo const* goInfo = GetGameObjectInfo(itr->first);
|
||||
if(!goInfo)
|
||||
if (!goInfo)
|
||||
sLog.outErrorDb("Table `gameobject_involvedrelation` have data for nonexistent gameobject entry (%u) and existing quest %u",itr->first,itr->second);
|
||||
else if(goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
sLog.outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER",itr->first,itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureQuestRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(mCreatureQuestRelations,"creature_questrelation");
|
||||
LoadQuestRelationsHelper(m_CreatureQuestRelations, "creature_questrelation");
|
||||
|
||||
for(QuestRelations::iterator itr = mCreatureQuestRelations.begin(); itr != mCreatureQuestRelations.end(); ++itr)
|
||||
for(QuestRelationsMap::iterator itr = m_CreatureQuestRelations.begin(); itr != m_CreatureQuestRelations.end(); ++itr)
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
|
||||
if(!cInfo)
|
||||
if (!cInfo)
|
||||
sLog.outErrorDb("Table `creature_questrelation` have data for nonexistent creature entry (%u) and existing quest %u",itr->first,itr->second);
|
||||
else if(!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
sLog.outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER",itr->first,itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureInvolvedRelations()
|
||||
{
|
||||
LoadQuestRelationsHelper(mCreatureQuestInvolvedRelations,"creature_involvedrelation");
|
||||
LoadQuestRelationsHelper(m_CreatureQuestInvolvedRelations, "creature_involvedrelation");
|
||||
|
||||
for(QuestRelations::iterator itr = mCreatureQuestInvolvedRelations.begin(); itr != mCreatureQuestInvolvedRelations.end(); ++itr)
|
||||
for(QuestRelationsMap::iterator itr = m_CreatureQuestInvolvedRelations.begin(); itr != m_CreatureQuestInvolvedRelations.end(); ++itr)
|
||||
{
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(itr->first);
|
||||
if(!cInfo)
|
||||
if (!cInfo)
|
||||
sLog.outErrorDb("Table `creature_involvedrelation` have data for nonexistent creature entry (%u) and existing quest %u",itr->first,itr->second);
|
||||
else if(!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
|
||||
sLog.outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER",itr->first,itr->second);
|
||||
}
|
||||
}
|
||||
|
|
@ -7714,7 +7717,7 @@ void ObjectMgr::LoadGameObjectForQuests()
|
|||
for(uint32 go_entry = 1; go_entry < sGOStorage.MaxEntry; ++go_entry)
|
||||
{
|
||||
bar.step();
|
||||
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(go_entry);
|
||||
GameObjectInfo const* goInfo = GetGameObjectInfo(go_entry);
|
||||
if (!goInfo)
|
||||
continue;
|
||||
|
||||
|
|
@ -7722,12 +7725,8 @@ void ObjectMgr::LoadGameObjectForQuests()
|
|||
{
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER:
|
||||
{
|
||||
if (mGOQuestRelations.find(go_entry) != mGOQuestRelations.end())
|
||||
{
|
||||
mGameObjectForQuestSet.insert(go_entry);
|
||||
++count;
|
||||
}
|
||||
else if (mGOQuestInvolvedRelations.find(go_entry) != mGOQuestInvolvedRelations.end())
|
||||
if (m_GOQuestRelations.find(go_entry) != m_GOQuestRelations.end() ||
|
||||
m_GOQuestInvolvedRelations.find(go_entry) != m_GOQuestInvolvedRelations.end())
|
||||
{
|
||||
mGameObjectForQuestSet.insert(go_entry);
|
||||
++count;
|
||||
|
|
|
|||
|
|
@ -441,9 +441,12 @@ typedef UNORDERED_MAP<int32,MangosStringLocale> MangosStringLocaleMap;
|
|||
typedef UNORDERED_MAP<uint32,GossipMenuItemsLocale> GossipMenuItemsLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32,PointOfInterestLocale> PointOfInterestLocaleMap;
|
||||
|
||||
typedef std::multimap<uint32,uint32> QuestRelations;
|
||||
typedef std::multimap<uint32,ItemRequiredTarget> ItemRequiredTargetMap;
|
||||
typedef std::multimap<int32, uint32> ExclusiveQuestGroupsMap;
|
||||
typedef std::multimap<uint32, ItemRequiredTarget> ItemRequiredTargetMap;
|
||||
typedef std::multimap<uint32, uint32> QuestRelationsMap;
|
||||
typedef std::pair<ExclusiveQuestGroupsMap::const_iterator, ExclusiveQuestGroupsMap::const_iterator> ExclusiveQuestGroupsMapBounds;
|
||||
typedef std::pair<ItemRequiredTargetMap::const_iterator, ItemRequiredTargetMap::const_iterator> ItemRequiredTargetMapBounds;
|
||||
typedef std::pair<QuestRelationsMap::const_iterator, QuestRelationsMap::const_iterator> QuestRelationsMapBounds;
|
||||
|
||||
struct PetLevelInfo
|
||||
{
|
||||
|
|
@ -584,7 +587,8 @@ struct GraveYardData
|
|||
uint32 safeLocId;
|
||||
uint32 team;
|
||||
};
|
||||
typedef std::multimap<uint32,GraveYardData> GraveYardMap;
|
||||
typedef std::multimap<uint32, GraveYardData> GraveYardMap;
|
||||
typedef std::pair<GraveYardMap::const_iterator, GraveYardMap::const_iterator> GraveYardMapBounds;
|
||||
|
||||
enum ConditionType
|
||||
{ // value1 value2 for the Condition enumed
|
||||
|
|
@ -829,7 +833,7 @@ class ObjectMgr
|
|||
WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team);
|
||||
bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true);
|
||||
void LoadGraveyardZones();
|
||||
GraveYardData const* FindGraveYardData(uint32 id, uint32 zone);
|
||||
GraveYardData const* FindGraveYardData(uint32 id, uint32 zone) const;
|
||||
|
||||
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
|
||||
{
|
||||
|
|
@ -903,11 +907,6 @@ class ObjectMgr
|
|||
void LoadCreatureQuestRelations();
|
||||
void LoadCreatureInvolvedRelations();
|
||||
|
||||
QuestRelations mGOQuestRelations;
|
||||
QuestRelations mGOQuestInvolvedRelations;
|
||||
QuestRelations mCreatureQuestRelations;
|
||||
QuestRelations mCreatureQuestInvolvedRelations;
|
||||
|
||||
void LoadGameObjectScripts();
|
||||
void LoadQuestEndScripts();
|
||||
void LoadQuestStartScripts();
|
||||
|
|
@ -1004,9 +1003,6 @@ class ObjectMgr
|
|||
uint32 GenerateMailID() { return m_MailIds.Generate(); }
|
||||
uint32 GeneratePetNumber() { return m_PetNumbers.Generate(); }
|
||||
|
||||
typedef std::multimap<int32, uint32> ExclusiveQuestGroups;
|
||||
ExclusiveQuestGroups mExclusiveQuestGroups;
|
||||
|
||||
MailLevelReward const* GetMailLevelReward(uint32 level,uint32 raceMask)
|
||||
{
|
||||
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
|
||||
|
|
@ -1064,42 +1060,49 @@ class ObjectMgr
|
|||
if(itr==mCreatureLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
||||
{
|
||||
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
||||
if(itr==mGameObjectLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
ItemLocale const* GetItemLocale(uint32 entry) const
|
||||
{
|
||||
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
||||
if(itr==mItemLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||
{
|
||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||
if(itr==mQuestLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||
{
|
||||
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
||||
if(itr==mNpcTextLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
||||
{
|
||||
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
||||
if(itr==mPageTextLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
||||
{
|
||||
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
||||
if(itr==mGossipMenuItemsLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
||||
{
|
||||
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
||||
|
|
@ -1137,6 +1140,7 @@ class ObjectMgr
|
|||
if(itr==mMangosStringLocaleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
const char *GetMangosString(int32 entry, int locale_idx) const;
|
||||
const char *GetMangosStringForDBCLocale(int32 entry) const { return GetMangosString(entry,DBCLocaleIndex); }
|
||||
int32 GetDBCLocaleIndex() const { return DBCLocaleIndex; }
|
||||
|
|
@ -1186,6 +1190,7 @@ class ObjectMgr
|
|||
if(itr==m_GameTeleMap.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GameTele const* GetGameTele(const std::string& name) const;
|
||||
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
|
||||
bool AddGameTele(GameTele& data);
|
||||
|
|
@ -1217,6 +1222,7 @@ class ObjectMgr
|
|||
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost);
|
||||
bool RemoveVendorItem(uint32 entry,uint32 item);
|
||||
bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL ) const;
|
||||
|
|
@ -1230,26 +1236,52 @@ class ObjectMgr
|
|||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
{
|
||||
return SpellClickInfoMapBounds(mSpellClickInfoMap.lower_bound(creature_id),mSpellClickInfoMap.upper_bound(creature_id));
|
||||
return mSpellClickInfoMap.equal_range(creature_id);
|
||||
}
|
||||
|
||||
ItemRequiredTargetMapBounds GetItemRequiredTargetMapBounds(uint32 uiItemEntry) const
|
||||
{
|
||||
return ItemRequiredTargetMapBounds(m_ItemRequiredTarget.lower_bound(uiItemEntry),m_ItemRequiredTarget.upper_bound(uiItemEntry));
|
||||
return m_ItemRequiredTarget.equal_range(uiItemEntry);
|
||||
}
|
||||
|
||||
GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenusMapBounds(m_mGossipMenusMap.lower_bound(uiMenuId),m_mGossipMenusMap.upper_bound(uiMenuId));
|
||||
return m_mGossipMenusMap.equal_range(uiMenuId);
|
||||
}
|
||||
|
||||
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenuItemsMapBounds(m_mGossipMenuItemsMap.lower_bound(uiMenuId),m_mGossipMenuItemsMap.upper_bound(uiMenuId));
|
||||
return m_mGossipMenuItemsMap.equal_range(uiMenuId);
|
||||
}
|
||||
|
||||
uint32 GetModelForRace(uint32 sourceModelId, uint32 racemask);
|
||||
ExclusiveQuestGroupsMapBounds GetExclusiveQuestGroupsMapBounds(int32 groupId) const
|
||||
{
|
||||
return m_ExclusiveQuestGroups.equal_range(groupId);
|
||||
}
|
||||
|
||||
QuestRelationsMapBounds GetCreatureQuestRelationsMapBounds(uint32 entry) const
|
||||
{
|
||||
return m_CreatureQuestRelations.equal_range(entry);
|
||||
}
|
||||
|
||||
QuestRelationsMapBounds GetCreatureQuestInvolvedRelationsMapBounds(uint32 entry) const
|
||||
{
|
||||
return m_CreatureQuestInvolvedRelations.equal_range(entry);
|
||||
}
|
||||
|
||||
QuestRelationsMapBounds GetGOQuestRelationsMapBounds(uint32 entry) const
|
||||
{
|
||||
return m_GOQuestRelations.equal_range(entry);
|
||||
}
|
||||
|
||||
QuestRelationsMapBounds GetGOQuestInvolvedRelationsMapBounds(uint32 entry) const
|
||||
{
|
||||
return m_GOQuestInvolvedRelations.equal_range(entry);
|
||||
}
|
||||
|
||||
QuestRelationsMap& GetCreatureQuestRelationsMap() { return m_CreatureQuestRelations; }
|
||||
|
||||
uint32 GetModelForRace(uint32 sourceModelId, uint32 racemask);
|
||||
protected:
|
||||
|
||||
// first free id for selected id type
|
||||
|
|
@ -1276,6 +1308,7 @@ class ObjectMgr
|
|||
typedef std::set<uint32> GameObjectForQuestSet;
|
||||
|
||||
typedef std::multimap<uint32, CreatureModelRace> CreatureModelRaceMap;
|
||||
typedef std::pair<CreatureModelRaceMap::const_iterator, CreatureModelRaceMap::const_iterator> CreatureModelRaceMapBounds;
|
||||
|
||||
GroupMap mGroupMap;
|
||||
GuildMap mGuildMap;
|
||||
|
|
@ -1319,6 +1352,13 @@ class ObjectMgr
|
|||
typedef std::vector<LocaleConstant> LocalForIndex;
|
||||
LocalForIndex m_LocalForIndex;
|
||||
|
||||
ExclusiveQuestGroupsMap m_ExclusiveQuestGroups;
|
||||
|
||||
QuestRelationsMap m_CreatureQuestRelations;
|
||||
QuestRelationsMap m_CreatureQuestInvolvedRelations;
|
||||
QuestRelationsMap m_GOQuestRelations;
|
||||
QuestRelationsMap m_GOQuestInvolvedRelations;
|
||||
|
||||
int DBCLocaleIndex;
|
||||
|
||||
private:
|
||||
|
|
@ -1326,7 +1366,7 @@ class ObjectMgr
|
|||
void CheckScriptTexts(ScriptMapMap const& scripts,std::set<int32>& ids);
|
||||
void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
|
||||
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
|
||||
void LoadQuestRelationsHelper(QuestRelations& map,char const* table);
|
||||
void LoadQuestRelationsHelper(QuestRelationsMap& map, char const* table);
|
||||
|
||||
MailLevelRewardMap m_mailLevelRewardMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -13070,18 +13070,16 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject *pSource)
|
|||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void Player::PrepareQuestMenu( uint64 guid )
|
||||
void Player::PrepareQuestMenu(uint64 guid)
|
||||
{
|
||||
Object *pObject;
|
||||
QuestRelations* pObjectQR;
|
||||
QuestRelations* pObjectQIR;
|
||||
QuestRelationsMapBounds rbounds;
|
||||
QuestRelationsMapBounds irbounds;
|
||||
|
||||
// pets also can have quests
|
||||
if (Creature *pCreature = GetMap()->GetAnyTypeCreature(guid))
|
||||
{
|
||||
pObject = (Object*)pCreature;
|
||||
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
||||
pObjectQIR = &sObjectMgr.mCreatureQuestInvolvedRelations;
|
||||
rbounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(pCreature->GetEntry());
|
||||
irbounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(pCreature->GetEntry());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -13089,12 +13087,11 @@ void Player::PrepareQuestMenu( uint64 guid )
|
|||
//only for quests which cast teleport spells on player
|
||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
MANGOS_ASSERT(_map);
|
||||
GameObject *pGameObject = _map->GetGameObject(guid);
|
||||
if( pGameObject )
|
||||
|
||||
if (GameObject *pGameObject = _map->GetGameObject(guid))
|
||||
{
|
||||
pObject = (Object*)pGameObject;
|
||||
pObjectQR = &sObjectMgr.mGOQuestRelations;
|
||||
pObjectQIR = &sObjectMgr.mGOQuestInvolvedRelations;
|
||||
rbounds = sObjectMgr.GetGOQuestRelationsMapBounds(pGameObject->GetEntry());
|
||||
irbounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(pGameObject->GetEntry());
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
|
@ -13103,29 +13100,32 @@ void Player::PrepareQuestMenu( uint64 guid )
|
|||
QuestMenu &qm = PlayerTalkClass->GetQuestMenu();
|
||||
qm.ClearMenu();
|
||||
|
||||
for(QuestRelations::const_iterator i = pObjectQIR->lower_bound(pObject->GetEntry()); i != pObjectQIR->upper_bound(pObject->GetEntry()); ++i)
|
||||
for(QuestRelationsMap::const_iterator itr = irbounds.first; itr != irbounds.second; ++itr)
|
||||
{
|
||||
uint32 quest_id = i->second;
|
||||
QuestStatus status = GetQuestStatus( quest_id );
|
||||
if ( status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus( quest_id ) )
|
||||
uint32 quest_id = itr->second;
|
||||
QuestStatus status = GetQuestStatus(quest_id);
|
||||
|
||||
if (status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(quest_id))
|
||||
qm.AddMenuItem(quest_id, 4);
|
||||
else if ( status == QUEST_STATUS_INCOMPLETE )
|
||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||
qm.AddMenuItem(quest_id, 4);
|
||||
else if (status == QUEST_STATUS_AVAILABLE )
|
||||
else if (status == QUEST_STATUS_AVAILABLE)
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
}
|
||||
|
||||
for(QuestRelations::const_iterator i = pObjectQR->lower_bound(pObject->GetEntry()); i != pObjectQR->upper_bound(pObject->GetEntry()); ++i)
|
||||
for(QuestRelationsMap::const_iterator itr = rbounds.first; itr != rbounds.second; ++itr)
|
||||
{
|
||||
uint32 quest_id = i->second;
|
||||
uint32 quest_id = itr->second;
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
if(!pQuest) continue;
|
||||
|
||||
QuestStatus status = GetQuestStatus( quest_id );
|
||||
if (!pQuest)
|
||||
continue;
|
||||
|
||||
QuestStatus status = GetQuestStatus(quest_id);
|
||||
|
||||
if (pQuest->IsAutoComplete() && CanTakeQuest(pQuest, false))
|
||||
qm.AddMenuItem(quest_id, 4);
|
||||
else if ( status == QUEST_STATUS_NONE && CanTakeQuest( pQuest, false ) )
|
||||
else if (status == QUEST_STATUS_NONE && CanTakeQuest(pQuest, false))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -13238,17 +13238,13 @@ bool Player::IsCurrentQuest( uint32 quest_id ) const
|
|||
return itr->second.m_status == QUEST_STATUS_INCOMPLETE || itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded;
|
||||
}
|
||||
|
||||
Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
|
||||
Quest const* Player::GetNextQuest(uint64 guid, Quest const *pQuest)
|
||||
{
|
||||
Object *pObject;
|
||||
QuestRelations* pObjectQR;
|
||||
QuestRelations* pObjectQIR;
|
||||
QuestRelationsMapBounds rbounds;
|
||||
|
||||
if (Creature *pCreature = GetMap()->GetAnyTypeCreature(guid))
|
||||
{
|
||||
pObject = (Object*)pCreature;
|
||||
pObjectQR = &sObjectMgr.mCreatureQuestRelations;
|
||||
pObjectQIR = &sObjectMgr.mCreatureQuestInvolvedRelations;
|
||||
rbounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(pCreature->GetEntry());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -13256,19 +13252,17 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
|
|||
//only for quests which cast teleport spells on player
|
||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
MANGOS_ASSERT(_map);
|
||||
GameObject *pGameObject = _map->GetGameObject(guid);
|
||||
if( pGameObject )
|
||||
|
||||
if (GameObject *pGameObject = _map->GetGameObject(guid))
|
||||
{
|
||||
pObject = (Object*)pGameObject;
|
||||
pObjectQR = &sObjectMgr.mGOQuestRelations;
|
||||
pObjectQIR = &sObjectMgr.mGOQuestInvolvedRelations;
|
||||
rbounds = sObjectMgr.GetGOQuestRelationsMapBounds(pGameObject->GetEntry());
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32 nextQuestID = pQuest->GetNextQuestInChain();
|
||||
for(QuestRelations::const_iterator itr = pObjectQR->lower_bound(pObject->GetEntry()); itr != pObjectQR->upper_bound(pObject->GetEntry()); ++itr)
|
||||
for(QuestRelationsMap::const_iterator itr = rbounds.first; itr != rbounds.second; ++itr)
|
||||
{
|
||||
if (itr->second == nextQuestID)
|
||||
return sObjectMgr.GetQuestTemplate(nextQuestID);
|
||||
|
|
@ -13867,12 +13861,11 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
|
|||
|
||||
// each-from-all exclusive group ( < 0)
|
||||
// can be start if only all quests in prev quest exclusive group completed and rewarded
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ExclusiveQuestGroupsMapBounds bounds = sObjectMgr.GetExclusiveQuestGroupsMapBounds(qPrevInfo->GetExclusiveGroup());
|
||||
|
||||
MANGOS_ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
MANGOS_ASSERT(bounds.first != bounds.second); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
|
||||
for(; iter2 != end; ++iter2)
|
||||
for(ExclusiveQuestGroupsMap::const_iterator iter2 = bounds.first; iter2 != bounds.second; ++iter2)
|
||||
{
|
||||
uint32 exclude_Id = iter2->second;
|
||||
|
||||
|
|
@ -13901,12 +13894,11 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
|
|||
|
||||
// each-from-all exclusive group ( < 0)
|
||||
// can be start if only all quests in prev quest exclusive group active
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup());
|
||||
ExclusiveQuestGroupsMapBounds bounds = sObjectMgr.GetExclusiveQuestGroupsMapBounds(qPrevInfo->GetExclusiveGroup());
|
||||
|
||||
MANGOS_ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
MANGOS_ASSERT(bounds.first != bounds.second); // always must be found if qPrevInfo->ExclusiveGroup != 0
|
||||
|
||||
for(; iter2 != end; ++iter2)
|
||||
for(ExclusiveQuestGroupsMap::const_iterator iter2 = bounds.first; iter2 != bounds.second; ++iter2)
|
||||
{
|
||||
uint32 exclude_Id = iter2->second;
|
||||
|
||||
|
|
@ -13994,18 +13986,17 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) const
|
||||
bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const
|
||||
{
|
||||
// non positive exclusive group, if > 0 then can be start if any other quest in exclusive group already started/completed
|
||||
if (qInfo->GetExclusiveGroup() <= 0)
|
||||
return true;
|
||||
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup());
|
||||
ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup());
|
||||
ExclusiveQuestGroupsMapBounds bounds = sObjectMgr.GetExclusiveQuestGroupsMapBounds(qInfo->GetExclusiveGroup());
|
||||
|
||||
MANGOS_ASSERT(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0
|
||||
MANGOS_ASSERT(bounds.first != bounds.second); // always must be found if qInfo->ExclusiveGroup != 0
|
||||
|
||||
for(; iter != end; ++iter)
|
||||
for(ExclusiveQuestGroupsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
{
|
||||
uint32 exclude_Id = iter->second;
|
||||
|
||||
|
|
|
|||
|
|
@ -553,33 +553,33 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
|
|||
{
|
||||
uint32 dialogStatus = defstatus;
|
||||
|
||||
QuestRelations const* qir;
|
||||
QuestRelations const* qr;
|
||||
QuestRelationsMapBounds rbounds;
|
||||
QuestRelationsMapBounds irbounds;
|
||||
|
||||
switch(questgiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
qir = &sObjectMgr.mGOQuestInvolvedRelations;
|
||||
qr = &sObjectMgr.mGOQuestRelations;
|
||||
break;
|
||||
}
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
qir = &sObjectMgr.mCreatureQuestInvolvedRelations;
|
||||
qr = &sObjectMgr.mCreatureQuestRelations;
|
||||
rbounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(questgiver->GetEntry());
|
||||
irbounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(questgiver->GetEntry());
|
||||
break;
|
||||
}
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
rbounds = sObjectMgr.GetGOQuestRelationsMapBounds(questgiver->GetEntry());
|
||||
irbounds = sObjectMgr.GetGOQuestInvolvedRelationsMapBounds(questgiver->GetEntry());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//its imposible, but check ^)
|
||||
//it's impossible, but check ^)
|
||||
sLog.outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
|
||||
return DIALOG_STATUS_NONE;
|
||||
}
|
||||
|
||||
for(QuestRelations::const_iterator i = qir->lower_bound(questgiver->GetEntry()); i != qir->upper_bound(questgiver->GetEntry()); ++i)
|
||||
for(QuestRelationsMap::const_iterator itr = irbounds.first; itr != irbounds.second; ++itr)
|
||||
{
|
||||
uint32 dialogStatusNew = 0;
|
||||
uint32 quest_id = i->second;
|
||||
uint32 quest_id = itr->second;
|
||||
Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
|
||||
if (!pQuest)
|
||||
|
|
@ -602,10 +602,10 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32
|
|||
dialogStatus = dialogStatusNew;
|
||||
}
|
||||
|
||||
for(QuestRelations::const_iterator i = qr->lower_bound(questgiver->GetEntry()); i != qr->upper_bound(questgiver->GetEntry()); ++i)
|
||||
for(QuestRelationsMap::const_iterator itr = rbounds.first; itr != rbounds.second; ++itr)
|
||||
{
|
||||
uint32 dialogStatusNew = 0;
|
||||
uint32 quest_id = i->second;
|
||||
uint32 quest_id = itr->second;
|
||||
Quest const *pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
|
||||
if (!pQuest)
|
||||
|
|
|
|||
|
|
@ -2443,9 +2443,8 @@ void SpellMgr::LoadSpellChains()
|
|||
continue;
|
||||
|
||||
// some forward spells still exist but excluded from real use as ranks and not listed in skill abilities now
|
||||
SkillLineAbilityMap::const_iterator forward_ab_low = mSkillLineAbilityMap.lower_bound(forward_id);
|
||||
SkillLineAbilityMap::const_iterator forward_ab_up = mSkillLineAbilityMap.upper_bound(forward_id);
|
||||
if (forward_ab_low == forward_ab_up)
|
||||
SkillLineAbilityMapBounds bounds = mSkillLineAbilityMap.equal_range(forward_id);
|
||||
if (bounds.first == bounds.second)
|
||||
continue;
|
||||
|
||||
// spell already listed in chains store
|
||||
|
|
@ -2639,11 +2638,11 @@ void SpellMgr::LoadSpellChains()
|
|||
{
|
||||
bool skip = false;
|
||||
// some forward spells still exist but excluded from real use as ranks and not listed in skill abilities now
|
||||
SkillLineAbilityMap::const_iterator forward_ab_low = mSkillLineAbilityMap.lower_bound(spell_id);
|
||||
SkillLineAbilityMap::const_iterator forward_ab_up = mSkillLineAbilityMap.upper_bound(spell_id);
|
||||
if (forward_ab_low == forward_ab_up)
|
||||
SkillLineAbilityMapBounds bounds = mSkillLineAbilityMap.equal_range(spell_id);
|
||||
if (bounds.first == bounds.second)
|
||||
{
|
||||
for(SkillLineAbilityMap::const_iterator ab_itr = mSkillLineAbilityMap.lower_bound(node.prev); ab_itr != mSkillLineAbilityMap.upper_bound(node.prev); ++ab_itr)
|
||||
SkillLineAbilityMapBounds prev_bounds = mSkillLineAbilityMap.equal_range(node.prev);
|
||||
for(SkillLineAbilityMap::const_iterator ab_itr = prev_bounds.first; ab_itr != prev_bounds.second; ++ab_itr)
|
||||
{
|
||||
// spell listed as forward and not listed as ability
|
||||
// this is marker for removed ranks
|
||||
|
|
|
|||
|
|
@ -996,7 +996,7 @@ class SpellMgr
|
|||
|
||||
SpellLearnSpellMapBounds GetSpellLearnSpellMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellLearnSpellMapBounds(mSpellLearnSpells.lower_bound(spell_id),mSpellLearnSpells.upper_bound(spell_id));
|
||||
return mSpellLearnSpells.equal_range(spell_id);
|
||||
}
|
||||
|
||||
bool IsSpellLearnToSpell(uint32 spell_id1,uint32 spell_id2) const
|
||||
|
|
@ -1019,7 +1019,7 @@ class SpellMgr
|
|||
// Spell script targets
|
||||
SpellScriptTargetBounds GetSpellScriptTargetBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellScriptTargetBounds(mSpellScriptTarget.lower_bound(spell_id),mSpellScriptTarget.upper_bound(spell_id));
|
||||
return mSpellScriptTarget.equal_range(spell_id);
|
||||
}
|
||||
|
||||
// Spell correctess for client using
|
||||
|
|
@ -1027,7 +1027,7 @@ class SpellMgr
|
|||
|
||||
SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SkillLineAbilityMapBounds(mSkillLineAbilityMap.lower_bound(spell_id),mSkillLineAbilityMap.upper_bound(spell_id));
|
||||
return mSkillLineAbilityMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
PetAura const* GetPetAura(uint32 spell_id, SpellEffectIndex eff)
|
||||
|
|
@ -1061,30 +1061,30 @@ class SpellMgr
|
|||
|
||||
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellAreaMapBounds(mSpellAreaMap.lower_bound(spell_id),mSpellAreaMap.upper_bound(spell_id));
|
||||
return mSpellAreaMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
|
||||
{
|
||||
if(active)
|
||||
return SpellAreaForQuestMapBounds(mSpellAreaForActiveQuestMap.lower_bound(quest_id),mSpellAreaForActiveQuestMap.upper_bound(quest_id));
|
||||
if (active)
|
||||
return mSpellAreaForActiveQuestMap.equal_range(quest_id);
|
||||
else
|
||||
return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id),mSpellAreaForQuestMap.upper_bound(quest_id));
|
||||
return mSpellAreaForQuestMap.equal_range(quest_id);
|
||||
}
|
||||
|
||||
SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
|
||||
{
|
||||
return SpellAreaForQuestMapBounds(mSpellAreaForQuestEndMap.lower_bound(quest_id),mSpellAreaForQuestEndMap.upper_bound(quest_id));
|
||||
return mSpellAreaForQuestEndMap.equal_range(quest_id);
|
||||
}
|
||||
|
||||
SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellAreaForAuraMapBounds(mSpellAreaForAuraMap.lower_bound(spell_id),mSpellAreaForAuraMap.upper_bound(spell_id));
|
||||
return mSpellAreaForAuraMap.equal_range(spell_id);
|
||||
}
|
||||
|
||||
SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const
|
||||
{
|
||||
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id));
|
||||
return mSpellAreaForAreaMap.equal_range(area_id);
|
||||
}
|
||||
|
||||
// Modifiers
|
||||
|
|
|
|||
|
|
@ -1391,11 +1391,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
|
||||
SpellAuraHolderBounds GetSpellAuraHolderBounds(uint32 spell_id)
|
||||
{
|
||||
return SpellAuraHolderBounds(m_spellAuraHolders.lower_bound(spell_id), m_spellAuraHolders.upper_bound(spell_id));
|
||||
return m_spellAuraHolders.equal_range(spell_id);
|
||||
}
|
||||
SpellAuraHolderConstBounds GetSpellAuraHolderBounds(uint32 spell_id) const
|
||||
{
|
||||
return SpellAuraHolderConstBounds(m_spellAuraHolders.lower_bound(spell_id), m_spellAuraHolders.upper_bound(spell_id));
|
||||
return m_spellAuraHolders.equal_range(spell_id);
|
||||
}
|
||||
|
||||
bool HasAuraType(AuraType auraType) const;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10593"
|
||||
#define REVISION_NR "10594"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue