2012-04-09 14:51:03 +02:00
|
|
|
/*
|
2014-01-01 00:07:53 +01:00
|
|
|
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
2012-04-09 14:51:03 +02:00
|
|
|
* Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
|
|
|
|
|
*
|
|
|
|
|
* 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 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "MMapFactory.h"
|
|
|
|
|
#include "World.h"
|
|
|
|
|
#include "Config.h"
|
2012-12-30 21:09:21 +01:00
|
|
|
#include "DisableMgr.h"
|
2012-04-09 14:51:03 +02:00
|
|
|
|
|
|
|
|
namespace MMAP
|
|
|
|
|
{
|
|
|
|
|
// ######################## MMapFactory ########################
|
|
|
|
|
// our global singleton copy
|
2013-10-03 17:47:38 -05:00
|
|
|
MMapManager* _manager = NULL;
|
2012-04-09 14:51:03 +02:00
|
|
|
|
2013-10-03 17:47:38 -05:00
|
|
|
MMapManager* MMapFactory::CreateOrGetMMapManager()
|
2012-04-09 14:51:03 +02:00
|
|
|
{
|
2013-10-03 17:47:38 -05:00
|
|
|
if (_manager == NULL)
|
|
|
|
|
_manager = new MMapManager();
|
2012-04-09 14:51:03 +02:00
|
|
|
|
2013-10-03 17:47:38 -05:00
|
|
|
return _manager;
|
2012-04-09 14:51:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MMapFactory::IsPathfindingEnabled(uint32 mapId)
|
|
|
|
|
{
|
|
|
|
|
return sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS)
|
2012-12-30 21:09:21 +01:00
|
|
|
&& !DisableMgr::IsDisabledFor(DISABLE_TYPE_MMAP, mapId, NULL, MMAP_DISABLE_PATHFINDING);
|
2012-04-09 14:51:03 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-03 17:47:38 -05:00
|
|
|
void MMapFactory::Clear()
|
2012-04-09 14:51:03 +02:00
|
|
|
{
|
2013-10-03 17:47:38 -05:00
|
|
|
if (_manager)
|
2012-04-09 14:51:03 +02:00
|
|
|
{
|
2013-10-03 17:47:38 -05:00
|
|
|
delete _manager;
|
|
|
|
|
_manager = NULL;
|
2012-04-09 14:51:03 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|