[7313] Optimized checks of presence in std::set

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
zhenya 2009-02-21 08:48:37 +03:00 committed by VladimirMangos
parent 7c2e850283
commit 8dbf8cda71
5 changed files with 15 additions and 10 deletions

View file

@ -202,11 +202,8 @@ class Channel
void SendToAllButOne(WorldPacket *data, uint64 who);
void SendToOne(WorldPacket *data, uint64 who);
bool IsOn(uint64 who) const { return players.count(who) != 0; }
bool IsBanned(const uint64 guid) const {return banned.count(guid) != 0; }
bool IsFirst() const { return !(players.size() > 1); }
bool IsOn(uint64 who) const { return players.find(who) != players.end(); }
bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); }
uint8 GetPlayerFlags(uint64 p) const
{

View file

@ -38,7 +38,7 @@ class ChannelMgr
}
Channel *GetJoinChannel(const std::string& name, uint32 channel_id)
{
if(channels.count(name) == 0)
if (channels.find(name) == channels.end())
{
Channel *nchan = new Channel(name,channel_id);
channels[name] = nchan;

View file

@ -406,8 +406,16 @@ class ObjectMgr
return itr->second;
return 0;
}
bool IsTavernAreaTrigger(uint32 Trigger_ID) const { return mTavernAreaTriggerSet.count(Trigger_ID) != 0; }
bool IsGameObjectForQuests(uint32 entry) const { return mGameObjectForQuestSet.count(entry) != 0; }
bool IsTavernAreaTrigger(uint32 Trigger_ID) const
{
return mTavernAreaTriggerSet.find(Trigger_ID) != mTavernAreaTriggerSet.end();
}
bool IsGameObjectForQuests(uint32 entry) const
{
return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
}
bool IsGuildVaultGameObject(Player *player, uint64 guid) const
{
if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid))

View file

@ -900,7 +900,7 @@ class SpellMgr
bool IsSpellLearnSpell(uint32 spell_id) const
{
return mSpellLearnSpells.count(spell_id)!=0;
return mSpellLearnSpells.find(spell_id) != mSpellLearnSpells.end();
}
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7312"
#define REVISION_NR "7313"
#endif // __REVISION_NR_H__