2 * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
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.
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.
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
19 #ifndef MANGOS_MAPMANAGER_H
20 #define MANGOS_MAPMANAGER_H
22 #include "Platform/Define.h"
23 #include "Policies/Singleton.h"
24 #include "zthread/Mutex.h"
29 class MANGOS_DLL_DECL MapManager
: public MaNGOS::Singleton
<MapManager
, MaNGOS::ClassLevelLockable
<MapManager
, ZThread::Mutex
> >
32 friend class MaNGOS::OperatorNew
<MapManager
>;
33 typedef HM_NAMESPACE::hash_map
<uint32
, Map
*> MapMapType
;
34 typedef std::pair
<HM_NAMESPACE::hash_map
<uint32
, Map
*>::iterator
, bool> MapMapPair
;
39 void Initialize(void);
42 inline void SetGridCleanUpDelay(uint32 t
)
44 if( t
< MIN_GRID_DELAY
)
45 i_gridCleanUpDelay
= MIN_GRID_DELAY
;
47 i_gridCleanUpDelay
= t
;
50 inline void SetMapUpdateInterval(uint32 t
)
55 i_timer
.SetInterval(t
);
60 void LoadGrid(int mapid
, float x
, float y
, bool no_unload
= false);
62 static bool ExistMAP(int mapid
, float x
, float y
);
64 void MoveAllCreaturesInMoveList();
66 void LoadTransports();
68 vector
<Transport
*> m_Transports
;
69 map
<uint32
, vector
< Transport
* > > m_TransportsByMap
;
75 MapManager(const MapManager
&);
76 MapManager
& operator=(const MapManager
&);
78 inline Map
* _getMap(uint32 id
)
80 MapMapType::iterator iter
= i_maps
.find(id
);
81 return (iter
== i_maps
.end() ? NULL
: iter
->second
);
84 typedef MaNGOS::ClassLevelLockable
<MapManager
, ZThread::Mutex
>::Lock Guard
;
85 uint32 i_gridCleanUpDelay
;
87 IntervalTimer i_timer
;