Files
TCPlayerbotCore/src/game/MapInstanced.h
T

81 lines
2.8 KiB
C++
Raw Normal View History

2008-10-02 16:23:55 -05:00
/*
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
2008-10-14 11:57:03 -05:00
*
2010-01-16 20:19:18 +03:00
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
2008-10-02 16:23:55 -05:00
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2008-10-02 16:23:55 -05:00
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2008-10-02 16:23:55 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-14 11:57:03 -05:00
#ifndef TRINITY_MAP_INSTANCED_H
#define TRINITY_MAP_INSTANCED_H
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include "Map.h"
#include "InstanceSaveMgr.h"
2009-12-17 11:30:18 +01:00
#include "DBCEnums.h"
2009-10-17 15:51:44 -07:00
2008-10-14 11:57:03 -05:00
class TRINITY_DLL_DECL MapInstanced : public Map
2008-10-02 16:23:55 -05:00
{
friend class MapManager;
public:
typedef UNORDERED_MAP< uint32, Map* > InstancedMaps;
2009-10-17 15:51:44 -07:00
MapInstanced(uint32 id, time_t expiry);
2008-10-02 16:23:55 -05:00
~MapInstanced() {}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// functions overwrite Map versions
void Update(const uint32&);
void DelayedUpdate(const uint32 diff);
//void RelocationNotify();
2008-10-02 16:23:55 -05:00
bool RemoveBones(uint64 guid, float x, float y);
2009-02-25 17:53:05 -06:00
void UnloadAll();
bool CanEnter(Player* player);
2009-10-17 15:51:44 -07:00
2009-12-17 11:30:18 +01:00
Map* CreateInstance(const uint32 mapId, Player * player);
Map* FindMap(uint32 InstanceId) const { return _FindMap(InstanceId); }
bool DestroyInstance(InstancedMaps::iterator &itr);
2009-10-17 15:51:44 -07:00
void AddGridMapReference(const GridPair &p)
{
++GridMapReference[p.x_coord][p.y_coord];
SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), true);
}
2009-10-17 15:51:44 -07:00
void RemoveGridMapReference(GridPair const& p)
2008-10-02 16:23:55 -05:00
{
--GridMapReference[p.x_coord][p.y_coord];
if (!GridMapReference[p.x_coord][p.y_coord])
SetUnloadReferenceLock(GridPair(63-p.x_coord, 63-p.y_coord), false);
2008-10-02 16:23:55 -05:00
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; }
virtual void InitVisibilityDistance();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
private:
2009-10-17 15:51:44 -07:00
2009-12-17 11:30:18 +01:00
InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty);
BattleGroundMap* CreateBattleGround(uint32 InstanceId, BattleGround* bg);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
InstancedMaps m_InstancedMaps;
2009-10-17 15:51:44 -07:00
Map* _FindMap(uint32 InstanceId) const
2008-10-02 16:23:55 -05:00
{
InstancedMaps::const_iterator i = m_InstancedMaps.find(InstanceId);
2008-10-02 16:23:55 -05:00
return(i == m_InstancedMaps.end() ? NULL : i->second);
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
};
#endif