Changeset 257 for trunk/src/game/Map.h

Show
Ignore:
Timestamp:
11/19/08 13:51:33 (17 years ago)
Author:
yumileroy
Message:

*Merge from Mangos. Add MapReference?. Author: hunuza.
*Also re-commit the patches reverted in 255.

Original author: megamage
Date: 2008-11-18 19:40:06-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Map.h

    r206 r257  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    3434#include "SharedDefines.h" 
    3535#include "GameSystem/GridRefManager.h" 
     36#include "MapRefManager.h" 
    3637 
    3738#include <bitset> 
     
    127128class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex> 
    128129{ 
     130    friend class MapReference; 
    129131    public: 
    130132        Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
     
    238240        GameObject* GetGameObjectInMap(uint64 guid); 
    239241 
     242        bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } 
     243        uint32 GetPlayersCountExceptGMs() const; 
     244        bool PlayersNearGrid(uint32 x,uint32 y) const; 
     245 
     246        void SendToPlayers(WorldPacket const* data) const; 
     247 
     248        typedef MapRefManager PlayerList; 
     249        PlayerList const& GetPlayers() const { return m_mapRefManager; } 
    240250        template<class T> void SwitchGridContainers(T* obj, bool active); 
    241251    private: 
     
    287297        uint32 m_unloadTimer; 
    288298 
     299        MapRefManager m_mapRefManager; 
    289300    private: 
    290301        typedef GridReadGuard ReadGuard; 
     
    326337{ 
    327338    public: 
    328         typedef std::list<Player *> PlayerList;                 // online players only 
    329  
    330339        InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); 
    331340        ~InstanceMap(); 
     
    338347        InstanceData* GetInstanceData() { return i_data; } 
    339348        void PermBindAllPlayers(Player *player); 
    340         PlayerList const& GetPlayers() const { return i_Players;} 
    341         void SendToPlayers(WorldPacket const* data) const; 
    342349        time_t GetResetTime(); 
    343350        void UnloadAll(bool pForce); 
    344351        bool CanEnter(Player* player); 
    345         uint32 GetPlayersCountExceptGMs() const; 
    346         uint32 HavePlayers() const { return !i_Players.empty(); } 
    347         void SendResetWarnings(uint32 timeLeft); 
     352        void SendResetWarnings(uint32 timeLeft) const; 
    348353        void SetResetSchedule(bool on); 
    349354    private: 
     
    360365{ 
    361366    public: 
    362         typedef std::list<Player *> PlayerList;                 // online players only 
    363  
    364367        BattleGroundMap(uint32 id, time_t, uint32 InstanceId); 
    365368        ~BattleGroundMap(); 
     
    370373        void SetUnload(); 
    371374        void UnloadAll(bool pForce); 
    372     private: 
    373         PlayerList i_Players; 
    374375}; 
    375376