[2] | 1 | /* |
---|
| 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
| 4 | * This program is free software; you can redistribute it and/or modify |
---|
| 5 | * it under the terms of the GNU General Public License as published by |
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | * (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | * GNU General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU General Public License |
---|
| 15 | * along with this program; if not, write to the Free Software |
---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef MANGOS_MAP_INSTANCED_H |
---|
| 20 | #define MANGOS_MAP_INSTANCED_H |
---|
| 21 | |
---|
| 22 | #include "Map.h" |
---|
| 23 | #include "InstanceSaveMgr.h" |
---|
| 24 | |
---|
| 25 | class MANGOS_DLL_DECL MapInstanced : public Map |
---|
| 26 | { |
---|
| 27 | friend class MapManager; |
---|
| 28 | public: |
---|
| 29 | typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; |
---|
| 30 | |
---|
| 31 | MapInstanced(uint32 id, time_t, uint32 aInstanceId); |
---|
| 32 | ~MapInstanced() {} |
---|
| 33 | |
---|
| 34 | // functions overwrite Map versions |
---|
| 35 | void Update(const uint32&); |
---|
| 36 | void MoveAllCreaturesInMoveList(); |
---|
| 37 | void RemoveAllObjectsInRemoveList(); |
---|
| 38 | bool RemoveBones(uint64 guid, float x, float y); |
---|
| 39 | void UnloadAll(bool pForce); |
---|
| 40 | |
---|
| 41 | Map* GetInstance(const WorldObject* obj); |
---|
| 42 | Map* FindMap(uint32 InstanceId) { return _FindMap(InstanceId); } |
---|
| 43 | void DestroyInstance(uint32 InstanceId); |
---|
| 44 | void DestroyInstance(InstancedMaps::iterator &itr); |
---|
| 45 | void AddGridMapReference(const GridPair &p) { ++GridMapReference[p.x_coord][p.y_coord]; } |
---|
| 46 | void RemoveGridMapReference(const GridPair &p) |
---|
| 47 | { |
---|
| 48 | --GridMapReference[p.x_coord][p.y_coord]; |
---|
| 49 | if (!GridMapReference[p.x_coord][p.y_coord]) { SetUnloadFlag(GridPair(63-p.x_coord,63-p.y_coord), true); } |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | InstancedMaps &GetInstancedMaps() { return m_InstancedMaps; } |
---|
| 53 | |
---|
| 54 | private: |
---|
| 55 | |
---|
| 56 | InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, uint8 difficulty); |
---|
| 57 | BattleGroundMap* CreateBattleGround(uint32 InstanceId); |
---|
| 58 | |
---|
| 59 | InstancedMaps m_InstancedMaps; |
---|
| 60 | |
---|
| 61 | Map* _FindMap(uint32 InstanceId) |
---|
| 62 | { |
---|
| 63 | InstancedMaps::iterator i = m_InstancedMaps.find(InstanceId); |
---|
| 64 | |
---|
| 65 | return(i == m_InstancedMaps.end() ? NULL : i->second); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | uint16 GridMapReference[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; |
---|
| 69 | }; |
---|
| 70 | #endif |
---|