mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7313] Optimized checks of presence in std::set
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
7c2e850283
commit
8dbf8cda71
5 changed files with 15 additions and 10 deletions
|
|
@ -202,11 +202,8 @@ class Channel
|
||||||
void SendToAllButOne(WorldPacket *data, uint64 who);
|
void SendToAllButOne(WorldPacket *data, uint64 who);
|
||||||
void SendToOne(WorldPacket *data, uint64 who);
|
void SendToOne(WorldPacket *data, uint64 who);
|
||||||
|
|
||||||
bool IsOn(uint64 who) const { return players.count(who) != 0; }
|
bool IsOn(uint64 who) const { return players.find(who) != players.end(); }
|
||||||
|
bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); }
|
||||||
bool IsBanned(const uint64 guid) const {return banned.count(guid) != 0; }
|
|
||||||
|
|
||||||
bool IsFirst() const { return !(players.size() > 1); }
|
|
||||||
|
|
||||||
uint8 GetPlayerFlags(uint64 p) const
|
uint8 GetPlayerFlags(uint64 p) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ChannelMgr
|
||||||
}
|
}
|
||||||
Channel *GetJoinChannel(const std::string& name, uint32 channel_id)
|
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);
|
Channel *nchan = new Channel(name,channel_id);
|
||||||
channels[name] = nchan;
|
channels[name] = nchan;
|
||||||
|
|
|
||||||
|
|
@ -406,8 +406,16 @@ class ObjectMgr
|
||||||
return itr->second;
|
return itr->second;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
bool IsTavernAreaTrigger(uint32 Trigger_ID) const { return mTavernAreaTriggerSet.count(Trigger_ID) != 0; }
|
bool IsTavernAreaTrigger(uint32 Trigger_ID) const
|
||||||
bool IsGameObjectForQuests(uint32 entry) const { return mGameObjectForQuestSet.count(entry) != 0; }
|
{
|
||||||
|
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
|
bool IsGuildVaultGameObject(Player *player, uint64 guid) const
|
||||||
{
|
{
|
||||||
if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid))
|
if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid))
|
||||||
|
|
|
||||||
|
|
@ -900,7 +900,7 @@ class SpellMgr
|
||||||
|
|
||||||
bool IsSpellLearnSpell(uint32 spell_id) const
|
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
|
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7312"
|
#define REVISION_NR "7313"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue