diff options
Diffstat (limited to 'src/game/Channel.cpp')
| -rw-r--r-- | src/game/Channel.cpp | 34 | 
1 files changed, 18 insertions, 16 deletions
diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index bf787d7d25d..588eb15f0cc 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -1,7 +1,7 @@  /* - * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>   * - * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> + * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@  #include "SocialMgr.h"  Channel::Channel(const std::string& name, uint32 channel_id) -: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0) +: m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id), m_ownerGUID(0)  {      // set special flags if built-in channel      ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id); @@ -171,7 +171,7 @@ void Channel::Leave(uint64 p, bool send)  void Channel::KickOrBan(uint64 good, const char *badname, bool ban)  { -    uint32 sec = 0; +    AccountTypes sec = SEC_PLAYER;      Player *gplr = objmgr.GetPlayer(good);      if(gplr)          sec = gplr->GetSession()->GetSecurity(); @@ -300,10 +300,11 @@ void Channel::Password(uint64 p, const char *pass)  void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)  { -    uint32 sec = 0;      Player *plr = objmgr.GetPlayer(p); -    if(plr) -        sec = plr->GetSession()->GetSecurity(); +    if (!plr) +        return; + +    uint32 sec = plr->GetSession()->GetSecurity();      if(!IsOn(p))      { @@ -368,10 +369,11 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)  void Channel::SetOwner(uint64 p, const char *newname)  { -    uint32 sec = 0;      Player *plr = objmgr.GetPlayer(p); -    if(plr) -        sec = plr->GetSession()->GetSecurity(); +    if (!plr) +        return; + +    uint32 sec = plr->GetSession()->GetSecurity();      if(!IsOn(p))      { @@ -449,13 +451,13 @@ void Channel::List(Player* player)          bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST) || player->GetSession()->GetSecurity() > SEC_PLAYER;          uint32 count  = 0; -        for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) +        for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)          {              Player *plr = objmgr.GetPlayer(i->first);              // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters              // MODERATOR, GAME MASTER, ADMINISTRATOR can see all -            if( plr && ( plr->GetSession()->GetSecurity() == SEC_PLAYER || gmInWhoList && plr->IsVisibleGloballyFor(player) ) ) +            if (plr && ( plr->GetSession()->GetSecurity() == SEC_PLAYER || (gmInWhoList && plr->IsVisibleGloballyFor(player))))              {                  data << uint64(i->first);                  data << uint8(i->second.flags);             // flags seems to be changed... @@ -662,7 +664,7 @@ void Channel::SetOwner(uint64 guid, bool exclaim)  void Channel::SendToAll(WorldPacket *data, uint64 p)  { -    for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) +    for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)      {          Player *plr = objmgr.GetPlayer(i->first);          if(plr) @@ -675,7 +677,7 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)  void Channel::SendToAllButOne(WorldPacket *data, uint64 who)  { -    for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) +    for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)      {          if(i->first != who)          { @@ -693,12 +695,12 @@ void Channel::SendToOne(WorldPacket *data, uint64 who)          plr->GetSession()->SendPacket(data);  } -void Channel::Voice(uint64 guid1, uint64 guid2) +void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)  {  } -void Channel::DeVoice(uint64 guid1, uint64 guid2) +void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)  {  }  | 
