diff options
Diffstat (limited to 'src/server/collision')
27 files changed, 187 insertions, 203 deletions
diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp index c5ae1f2a265..d90009c03f3 100644 --- a/src/server/collision/BoundingIntervalHierarchy.cpp +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index 997f9c99e5f..4d38bfc18c4 100644 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h index 8696a759fa8..955a394fb40 100644 --- a/src/server/collision/BoundingIntervalHierarchyWrapper.h +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ class BIHWrap RayCallback& _callback; uint32 objects_size; - MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) {} + MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) { } /// Intersect ray bool operator() (const G3D::Ray& ray, uint32 idx, float& maxDist, bool /*stopAtFirst*/) @@ -66,7 +66,7 @@ class BIHWrap int unbalanced_times; public: - BIHWrap() : unbalanced_times(0) {} + BIHWrap() : unbalanced_times(0) { } void insert(const T& obj) { diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt index f254ffda94c..a83bb9dad1c 100644 --- a/src/server/collision/CMakeLists.txt +++ b/src/server/collision/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> +# Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index aebcee0d689..f6d85df704a 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -107,9 +107,7 @@ struct DynTreeImpl : public ParentTree/*, public Intersectable*/ int unbalanced_times; }; -DynamicMapTree::DynamicMapTree() : impl(new DynTreeImpl()) -{ -} +DynamicMapTree::DynamicMapTree() : impl(new DynTreeImpl()) { } DynamicMapTree::~DynamicMapTree() { @@ -150,7 +148,7 @@ struct DynamicTreeIntersectionCallback { bool did_hit; uint32 phase_mask; - DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) {} + DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) { } bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance) { did_hit = obj.intersectRay(r, distance, true, phase_mask); @@ -165,16 +163,16 @@ struct DynamicTreeIntersectionCallback_WithLogger uint32 phase_mask; DynamicTreeIntersectionCallback_WithLogger(uint32 phasemask) : did_hit(false), phase_mask(phasemask) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Dynamic Intersection log"); + TC_LOG_DEBUG("maps", "Dynamic Intersection log"); } bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str()); + TC_LOG_DEBUG("maps", "testing intersection with %s", obj.name.c_str()); bool hit = obj.intersectRay(r, distance, true, phase_mask); if (hit) { did_hit = true; - TC_LOG_DEBUG(LOG_FILTER_MAPS, "result: intersects"); + TC_LOG_DEBUG("maps", "result: intersects"); } return hit; } diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h index 8e541fd453a..1657302de5d 100644 --- a/src/server/collision/DynamicTree.h +++ b/src/server/collision/DynamicTree.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/Management/IVMapManager.h b/src/server/collision/Management/IVMapManager.h index 9289d820e5b..02c2905345a 100644 --- a/src/server/collision/Management/IVMapManager.h +++ b/src/server/collision/Management/IVMapManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -49,9 +49,9 @@ namespace VMAP bool iEnableHeightCalc; public: - IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) {} + IVMapManager() : iEnableLineOfSightCalc(true), iEnableHeightCalc(true) { } - virtual ~IVMapManager(void) {} + virtual ~IVMapManager(void) { } virtual int loadMap(const char* pBasePath, unsigned int pMapId, int x, int y) = 0; diff --git a/src/server/collision/Management/MMapFactory.cpp b/src/server/collision/Management/MMapFactory.cpp index 6aa71d77ed8..43c726d9989 100644 --- a/src/server/collision/Management/MMapFactory.cpp +++ b/src/server/collision/Management/MMapFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ namespace MMAP { // ######################## MMapFactory ######################## // our global singleton copy - MMapManager* g_MMapManager = NULL; + MMapManager* _manager = NULL; - MMapManager* MMapFactory::createOrGetMMapManager() + MMapManager* MMapFactory::CreateOrGetMMapManager() { - if (g_MMapManager == NULL) - g_MMapManager = new MMapManager(); + if (_manager == NULL) + _manager = new MMapManager(); - return g_MMapManager; + return _manager; } bool MMapFactory::IsPathfindingEnabled(uint32 mapId) @@ -41,12 +41,12 @@ namespace MMAP && !DisableMgr::IsDisabledFor(DISABLE_TYPE_MMAP, mapId, NULL, MMAP_DISABLE_PATHFINDING); } - void MMapFactory::clear() + void MMapFactory::Clear() { - if (g_MMapManager) + if (_manager) { - delete g_MMapManager; - g_MMapManager = NULL; + delete _manager; + _manager = NULL; } } }
\ No newline at end of file diff --git a/src/server/collision/Management/MMapFactory.h b/src/server/collision/Management/MMapFactory.h index 038d44a941c..890befdff04 100644 --- a/src/server/collision/Management/MMapFactory.h +++ b/src/server/collision/Management/MMapFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -20,10 +20,6 @@ #define _MMAP_FACTORY_H #include "MMapManager.h" -#include "UnorderedMap.h" -#include "DetourAlloc.h" -#include "DetourNavMesh.h" -#include "DetourNavMeshQuery.h" namespace MMAP { @@ -40,8 +36,8 @@ namespace MMAP class MMapFactory { public: - static MMapManager* createOrGetMMapManager(); - static void clear(); + static MMapManager* CreateOrGetMMapManager(); + static void Clear(); static bool IsPathfindingEnabled(uint32 mapId); }; } diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index 65c13c07e66..6c6e39eeda2 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -22,32 +22,29 @@ namespace MMAP { - // ######################## MMapManager ######################## MMapManager::~MMapManager() { - for (MMapDataSet::iterator i = loadedMMaps.begin(); i != loadedMMaps.end(); ++i) + for (MMapDataSet::iterator i = _loadedMaps.begin(); i != _loadedMaps.end(); ++i) delete i->second; - - // by now we should not have maps loaded - // if we had, tiles in MMapData->mmapLoadedTiles, their actual data is lost! } - bool MMapManager::loadMapData(uint32 mapId) + bool MMapManager::LoadMap(uint32 mapId) { - // we already have this map loaded? - if (loadedMMaps.find(mapId) != loadedMMaps.end()) + // Do not load a map twice. + if (_loadedMaps.find(mapId) != _loadedMaps.end()) return true; // load and init dtNavMesh - read parameters from file - uint32 pathLen = sWorld->GetDataPath().length() + strlen("mmaps/%03i.mmap")+1; - char *fileName = new char[pathLen]; - snprintf(fileName, pathLen, (sWorld->GetDataPath()+"mmaps/%03i.mmap").c_str(), mapId); + std::string basePath = sWorld->GetDataPath(); + uint32 pathLen = basePath.length() + strlen("mmaps/%03i.mmap") + 1; + char* fileName = new char[pathLen]; + snprintf(fileName, pathLen, (basePath + "mmaps/%03i.mmap").c_str(), mapId); FILE* file = fopen(fileName, "rb"); if (!file) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName); - delete [] fileName; + TC_LOG_DEBUG("maps", "MMAP::LoadMap: Error: Could not open mmap file '%s'", fileName); + delete[] fileName; return false; } @@ -56,80 +53,75 @@ namespace MMAP fclose(file); if (count != 1) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMapData: Error: Could not read params from file '%s'", fileName); - delete [] fileName; + TC_LOG_DEBUG("maps", "MMAP::LoadMap: Error: Could not read params from file '%s'", fileName); + delete[] fileName; return false; } dtNavMesh* mesh = dtAllocNavMesh(); - ASSERT(mesh); if (dtStatusFailed(mesh->init(¶ms))) { dtFreeNavMesh(mesh); - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName); - delete [] fileName; + TC_LOG_ERROR("maps", "MMAP::LoadMap: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName); + delete[] fileName; return false; } - delete [] fileName; + delete[] fileName; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMapData: Loaded %03i.mmap", mapId); + TC_LOG_INFO("maps", "MMAP::LoadMap: Loaded %03i.mmap", mapId); // store inside our map list - MMapData* mmap_data = new MMapData(mesh); - mmap_data->mmapLoadedTiles.clear(); + MMapData* mmapData = new MMapData(mesh); + mmapData->_loadedTiles.clear(); - loadedMMaps.insert(std::pair<uint32, MMapData*>(mapId, mmap_data)); + _loadedMaps.insert(std::pair<uint32, MMapData*>(mapId, mmapData)); return true; } - uint32 MMapManager::packTileID(int32 x, int32 y) - { - return uint32(x << 16 | y); - } - - bool MMapManager::loadMap(const std::string& /*basePath*/, uint32 mapId, int32 x, int32 y) + bool MMapManager::LoadMapTile(uint32 mapId, int32 x, int32 y) { // make sure the mmap is loaded and ready to load tiles - if (!loadMapData(mapId)) + if (!LoadMap(mapId)) return false; // get this mmap data - MMapData* mmap = loadedMMaps[mapId]; + MMapData* mmap = _loadedMaps[mapId]; ASSERT(mmap->navMesh); - // check if we already have this tile loaded - uint32 packedGridPos = packTileID(x, y); - if (mmap->mmapLoadedTiles.find(packedGridPos) != mmap->mmapLoadedTiles.end()) + // Check if we already have this tile loaded + uint32 pos = PackTileId(x, y); + if (mmap->_loadedTiles.find(pos) != mmap->_loadedTiles.end()) return false; - // load this tile :: mmaps/MMMXXYY.mmtile - uint32 pathLen = sWorld->GetDataPath().length() + strlen("mmaps/%03i%02i%02i.mmtile")+1; - char *fileName = new char[pathLen]; + std::string basePath = sWorld->GetDataPath(); + uint32 pathLen = basePath.length() + strlen("mmaps/%03i%02i%02i.mmtile") + 1; + char* fileName = new char[pathLen]; - snprintf(fileName, pathLen, (sWorld->GetDataPath()+"mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y); + snprintf(fileName, pathLen, (basePath + "mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y); FILE* file = fopen(fileName, "rb"); if (!file) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMap: Could not open mmtile file '%s'", fileName); - delete [] fileName; + TC_LOG_DEBUG("maps", "MMAP::LoadMapTile: Could not open mmtile file '%s'", fileName); + delete[] fileName; return false; } - delete [] fileName; + + delete[] fileName; // read header MmapTileHeader fileHeader; if (fread(&fileHeader, sizeof(MmapTileHeader), 1, file) != 1 || fileHeader.mmapMagic != MMAP_MAGIC) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); fclose(file); return false; } if (fileHeader.mmapVersion != MMAP_VERSION) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION); fclose(file); return false; @@ -139,9 +131,9 @@ namespace MMAP ASSERT(data); size_t result = fread(data, fileHeader.size, 1, file); - if (!result) + if (result != 1) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y); fclose(file); return false; } @@ -154,14 +146,14 @@ namespace MMAP // memory allocated for data is now managed by detour, and will be deallocated when the tile is removed if (dtStatusSucceed(mmap->navMesh->addTile(data, fileHeader.size, DT_TILE_FREE_DATA, 0, &tileRef))) { - mmap->mmapLoadedTiles.insert(std::pair<uint32, dtTileRef>(packedGridPos, tileRef)); - ++loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); + mmap->_loadedTiles.insert(std::pair<uint32, dtTileRef>(pos, tileRef)); + ++_loadedTiles; + TC_LOG_INFO("maps", "MMAP::LoadMapTile: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); return true; } else { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y); dtFree(data); return false; } @@ -169,28 +161,26 @@ namespace MMAP return false; } - bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y) + bool MMapManager::UnloadMapTile(uint32 mapId, int32 x, int32 y) { - // check if we have this map loaded - if (loadedMMaps.find(mapId) == loadedMMaps.end()) + // Do not attempt to remove tiles from a not-loaded map + if (_loadedMaps.find(mapId) == _loadedMaps.end()) { - // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapTile: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y); return false; } - MMapData* mmap = loadedMMaps[mapId]; + MMapData* mmap = _loadedMaps[mapId]; // check if we have this tile loaded - uint32 packedGridPos = packTileID(x, y); - if (mmap->mmapLoadedTiles.find(packedGridPos) == mmap->mmapLoadedTiles.end()) + uint32 pos = PackTileId(x, y); + if (mmap->_loadedTiles.find(pos) == mmap->_loadedTiles.end()) { - // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapTile: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); return false; } - dtTileRef tileRef = mmap->mmapLoadedTiles[packedGridPos]; + dtTileRef tileRef = mmap->_loadedTiles[pos]; // unload, and mark as non loaded if (dtStatusFailed(mmap->navMesh->removeTile(tileRef, NULL, NULL))) @@ -198,107 +188,106 @@ namespace MMAP // this is technically a memory leak // if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used // we cannot recover from this error - assert out - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::UnloadMapTile: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); ASSERT(false); } else { - mmap->mmapLoadedTiles.erase(packedGridPos); - --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); + mmap->_loadedTiles.erase(pos); + --_loadedTiles; + TC_LOG_INFO("maps", "MMAP::UnloadMapTile: Unloaded mmtile [%02i, %02i] from %03i", x, y, mapId); return true; } return false; } - bool MMapManager::unloadMap(uint32 mapId) + bool MMapManager::UnloadMap(uint32 mapId) { - if (loadedMMaps.find(mapId) == loadedMMaps.end()) + if (_loadedMaps.find(mapId) == _loadedMaps.end()) { // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh map %03u", mapId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMap: Asked to unload not loaded navmesh map %03u", mapId); return false; } // unload all tiles from given map - MMapData* mmap = loadedMMaps[mapId]; - for (MMapTileSet::iterator i = mmap->mmapLoadedTiles.begin(); i != mmap->mmapLoadedTiles.end(); ++i) + MMapData* mmap = _loadedMaps[mapId]; + for (MMapTileSet::iterator i = mmap->_loadedTiles.begin(); i != mmap->_loadedTiles.end(); ++i) { uint32 x = (i->first >> 16); uint32 y = (i->first & 0x0000FFFF); if (dtStatusFailed(mmap->navMesh->removeTile(i->second, NULL, NULL))) - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::UnloadMap: Could not unload %03u%02u%02u.mmtile from navmesh", mapId, x, y); else { - --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); + --_loadedTiles; + TC_LOG_INFO("maps", "MMAP::UnloadMap: Unloaded mmtile [%02u, %02u] from %03u", x, y, mapId); } } delete mmap; - loadedMMaps.erase(mapId); - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded %03i.mmap", mapId); + _loadedMaps.erase(mapId); + TC_LOG_INFO("maps", "MMAP::UnloadMap: Unloaded %03u.mmap", mapId); return true; } - bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId) + bool MMapManager::UnloadMapInstance(uint32 mapId, uint32 instanceId) { // check if we have this map loaded - if (loadedMMaps.find(mapId) == loadedMMaps.end()) + if (_loadedMaps.find(mapId) == _loadedMaps.end()) { // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId); return false; } - MMapData* mmap = loadedMMaps[mapId]; - if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) + MMapData* mmap = _loadedMaps[mapId]; + if (mmap->_navMeshQueries.find(instanceId) == mmap->_navMeshQueries.end()) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId); return false; } - dtNavMeshQuery* query = mmap->navMeshQueries[instanceId]; + dtNavMeshQuery* query = mmap->_navMeshQueries[instanceId]; dtFreeNavMeshQuery(query); - mmap->navMeshQueries.erase(instanceId); - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId); + mmap->_navMeshQueries.erase(instanceId); + TC_LOG_INFO("maps", "MMAP::UnloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId); return true; } dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId) { - if (loadedMMaps.find(mapId) == loadedMMaps.end()) + if (_loadedMaps.find(mapId) == _loadedMaps.end()) return NULL; - return loadedMMaps[mapId]->navMesh; + return _loadedMaps[mapId]->navMesh; } dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId) { - if (loadedMMaps.find(mapId) == loadedMMaps.end()) + if (_loadedMaps.find(mapId) == _loadedMaps.end()) return NULL; - MMapData* mmap = loadedMMaps[mapId]; - if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) + MMapData* mmap = _loadedMaps[mapId]; + if (mmap->_navMeshQueries.find(instanceId) == mmap->_navMeshQueries.end()) { // allocate mesh query dtNavMeshQuery* query = dtAllocNavMeshQuery(); - ASSERT(query); - if (dtStatusFailed(query->init(mmap->navMesh, 1024))) + if (dtStatusFailed(query->init(mmap->navMesh, 2048))) { dtFreeNavMeshQuery(query); - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_ERROR("maps", "MMAP::GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); return NULL; } - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); - mmap->navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query)); + TC_LOG_INFO("maps", "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); + mmap->_navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query)); } - return mmap->navMeshQueries[instanceId]; + return mmap->_navMeshQueries[instanceId]; } } diff --git a/src/server/collision/Management/MMapManager.h b/src/server/collision/Management/MMapManager.h index 56b1b856d65..87bb4702dd2 100644 --- a/src/server/collision/Management/MMapManager.h +++ b/src/server/collision/Management/MMapManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -33,10 +33,10 @@ namespace MMAP // dummy struct to hold map's mmap data struct MMapData { - MMapData(dtNavMesh* mesh) : navMesh(mesh) {} + MMapData(dtNavMesh* mesh) : navMesh(mesh) { } ~MMapData() { - for (NavMeshQuerySet::iterator i = navMeshQueries.begin(); i != navMeshQueries.end(); ++i) + for (NavMeshQuerySet::iterator i = _navMeshQueries.begin(); i != _navMeshQueries.end(); ++i) dtFreeNavMeshQuery(i->second); if (navMesh) @@ -46,8 +46,8 @@ namespace MMAP dtNavMesh* navMesh; // we have to use single dtNavMeshQuery for every instance, since those are not thread safe - NavMeshQuerySet navMeshQueries; // instanceId to query - MMapTileSet mmapLoadedTiles; // maps [map grid coords] to [dtTile] + NavMeshQuerySet _navMeshQueries; // instanceId to query + MMapTileSet _loadedTiles; // maps [map grid coords] to [dtTile] }; @@ -58,26 +58,27 @@ namespace MMAP class MMapManager { public: - MMapManager() : loadedTiles(0) {} + MMapManager() : _loadedTiles(0) {} + ~MMapManager(); - bool loadMap(const std::string& basePath, uint32 mapId, int32 x, int32 y); - bool unloadMap(uint32 mapId, int32 x, int32 y); - bool unloadMap(uint32 mapId); - bool unloadMapInstance(uint32 mapId, uint32 instanceId); + bool LoadMapTile(uint32 mapId, int32 x, int32 y); + bool UnloadMapTile(uint32 mapId, int32 x, int32 y); + bool UnloadMap(uint32 mapId); + bool UnloadMapInstance(uint32 mapId, uint32 instanceId); // the returned [dtNavMeshQuery const*] is NOT threadsafe dtNavMeshQuery const* GetNavMeshQuery(uint32 mapId, uint32 instanceId); dtNavMesh const* GetNavMesh(uint32 mapId); - uint32 getLoadedTilesCount() const { return loadedTiles; } - uint32 getLoadedMapsCount() const { return loadedMMaps.size(); } + uint32 GetLoadedTilesCount() const { return _loadedTiles; } + uint32 GetLoadedMapsCount() const { return _loadedMaps.size(); } private: - bool loadMapData(uint32 mapId); - uint32 packTileID(int32 x, int32 y); + bool LoadMap(uint32 mapId); + uint32 PackTileId(int32 x, int32 y) { return uint32(x << 16 | y); } - MMapDataSet loadedMMaps; - uint32 loadedTiles; + MMapDataSet _loadedMaps; + uint32 _loadedTiles; }; } diff --git a/src/server/collision/Management/VMapFactory.cpp b/src/server/collision/Management/VMapFactory.cpp index 4d3719cf288..f4b92060ba3 100644 --- a/src/server/collision/Management/VMapFactory.cpp +++ b/src/server/collision/Management/VMapFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/Management/VMapFactory.h b/src/server/collision/Management/VMapFactory.h index 1545a8f6977..d09f4c50259 100644 --- a/src/server/collision/Management/VMapFactory.h +++ b/src/server/collision/Management/VMapFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 6355dbcf4ce..813a3c04288 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -260,11 +260,11 @@ namespace VMAP WorldModel* worldmodel = new WorldModel(); if (!worldmodel->readFile(basepath + filename + ".vmo")) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); + VMAP_ERROR_LOG("misc", "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); delete worldmodel; return NULL; } - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); + VMAP_DEBUG_LOG("maps", "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first; model->second.setModel(worldmodel); } @@ -280,12 +280,12 @@ namespace VMAP ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); + VMAP_ERROR_LOG("misc", "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); return; } if (model->second.decRefCount() == 0) { - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "VMapManager2: unloading file '%s'", filename.c_str()); + VMAP_DEBUG_LOG("maps", "VMapManager2: unloading file '%s'", filename.c_str()); delete model->second.getModel(); iLoadedModelFiles.erase(model); } diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h index 51f15f0fda4..abddd5d7cc3 100644 --- a/src/server/collision/Management/VMapManager2.h +++ b/src/server/collision/Management/VMapManager2.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ namespace VMAP class ManagedModel { public: - ManagedModel() : iModel(0), iRefCount(0) {} + ManagedModel() : iModel(0), iRefCount(0) { } void setModel(WorldModel* model) { iModel = model; } WorldModel* getModel() { return iModel; } void incRefCount() { ++iRefCount; } diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index 436f30eed10..bb57079c389 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ namespace VMAP class MapRayCallback { public: - MapRayCallback(ModelInstance* val): prims(val), hit(false) {} + MapRayCallback(ModelInstance* val): prims(val), hit(false) { } bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit=true) { bool result = prims[entry].intersectRay(ray, distance, pStopAtFirstHit); @@ -53,11 +53,11 @@ namespace VMAP class AreaInfoCallback { public: - AreaInfoCallback(ModelInstance* val): prims(val) {} + AreaInfoCallback(ModelInstance* val): prims(val) { } void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); + TC_LOG_DEBUG("maps", "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); #endif prims[entry].intersectPoint(point, aInfo); } @@ -69,11 +69,11 @@ namespace VMAP class LocationInfoCallback { public: - LocationInfoCallback(ModelInstance* val, LocationInfo &info): prims(val), locInfo(info), result(false) {} + LocationInfoCallback(ModelInstance* val, LocationInfo &info): prims(val), locInfo(info), result(false) { } void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); + TC_LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); #endif if (prims[entry].GetLocationInfo(point, locInfo)) result = true; @@ -278,7 +278,7 @@ namespace VMAP bool StaticMapTree::InitMap(const std::string &fname, VMapManager2* vm) { - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); + VMAP_DEBUG_LOG("maps", "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); bool success = false; std::string fullname = iBasePath + fname; FILE* rf = fopen(fullname.c_str(), "rb"); @@ -302,12 +302,12 @@ namespace VMAP // only non-tiled maps have them, and if so exactly one (so far at least...) ModelSpawn spawn; #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled)); + TC_LOG_DEBUG("maps", "StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled)); #endif if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); + VMAP_DEBUG_LOG("maps", "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); if (model) { // assume that global model always is the first and only tree value (could be improved...) @@ -317,7 +317,7 @@ namespace VMAP else { success = false; - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); + VMAP_ERROR_LOG("misc", "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); } } @@ -352,7 +352,7 @@ namespace VMAP } if (!iTreeValues) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); return false; } bool result = true; @@ -378,7 +378,7 @@ namespace VMAP // acquire model instance WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if (!model) - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); // update tree uint32 referencedVal; @@ -390,7 +390,7 @@ namespace VMAP #ifdef VMAP_DEBUG if (referencedVal > iNTreeValues) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues); continue; } #endif @@ -402,9 +402,9 @@ namespace VMAP ++iLoadedSpawns[referencedVal]; #ifdef VMAP_DEBUG if (iTreeValues[referencedVal].ID != spawn.ID) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node"); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node"); else if (iTreeValues[referencedVal].name != spawn.name) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID); #endif } } @@ -428,7 +428,7 @@ namespace VMAP loadedTileMap::iterator tile = iLoadedTiles.find(tileID); if (tile == iLoadedTiles.end()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); return; } if (tile->second) // file associated with tile @@ -462,7 +462,7 @@ namespace VMAP else { if (!iLoadedSpawns.count(referencedNode)) - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); + VMAP_ERROR_LOG("misc", "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); else if (--iLoadedSpawns[referencedNode] == 0) { iTreeValues[referencedNode].setUnloaded(); diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h index c66893da82f..90d61cbb88b 100644 --- a/src/server/collision/Maps/MapTree.h +++ b/src/server/collision/Maps/MapTree.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ namespace VMAP struct LocationInfo { - LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) {} + LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) { } const ModelInstance* hitInstance; const GroupModel* hitModel; float ground_Z; @@ -86,7 +86,7 @@ namespace VMAP struct AreaInfo { AreaInfo(): result(false), ground_Z(-G3D::inf()), flags(0), adtId(0), - rootId(0), groupId(0) {} + rootId(0), groupId(0) { } bool result; float ground_Z; uint32 flags; diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index f3a8b749a35..f2bc47638e6 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h index 56cb7600e4f..26a884551cd 100644 --- a/src/server/collision/Maps/TileAssembler.h +++ b/src/server/collision/Maps/TileAssembler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ namespace VMAP class WmoLiquid* liquid; GroupModel_Raw() : mogpflags(0), GroupWMOID(0), liquidflags(0), - liquid(NULL) {} + liquid(NULL) { } ~GroupModel_Raw(); bool Read(FILE* f); diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index a3af175a977..d254a640279 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ using G3D::AABox; struct GameobjectModelData { GameobjectModelData(const std::string& name_, const AABox& box) : - bound(box), name(name_) {} + bound(box), name(name_) { } AABox bound; std::string name; @@ -55,7 +55,7 @@ void LoadGameObjectModelList() FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); if (!model_list_file) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); + VMAP_ERROR_LOG("misc", "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); return; } @@ -74,7 +74,7 @@ void LoadGameObjectModelList() || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); + VMAP_ERROR_LOG("misc", "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); break; } @@ -85,7 +85,7 @@ void LoadGameObjectModelList() } fclose(model_list_file); - VMAP_INFO_LOG(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + VMAP_INFO_LOG("server.loading", ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); } GameObjectModel::~GameObjectModel() @@ -104,7 +104,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn // ignore models with no bounds if (mdl_box == G3D::AABox::zero()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); + VMAP_ERROR_LOG("misc", "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); return false; } diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h index 44abed55267..06a74cc6eb0 100644 --- a/src/server/collision/Models/GameObjectModel.h +++ b/src/server/collision/Models/GameObjectModel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ class GameObjectModel /*, public Intersectable*/ float iScale; VMAP::WorldModel* iModel; - GameObjectModel() : phasemask(0), iModel(NULL) {} + GameObjectModel() : phasemask(0), iModel(NULL) { } bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); public: diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp index 55759ea20c4..3262c154965 100644 --- a/src/server/collision/Models/ModelInstance.cpp +++ b/src/server/collision/Models/ModelInstance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h index f26089bb46c..3ea68f57ba4 100644 --- a/src/server/collision/Models/ModelInstance.h +++ b/src/server/collision/Models/ModelInstance.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ namespace VMAP class ModelInstance: public ModelSpawn { public: - ModelInstance(): iInvScale(0.0f), iModel(0) {} + ModelInstance(): iInvScale(0.0f), iModel(0) { } ModelInstance(const ModelSpawn &spawn, WorldModel* model); void setUnloaded() { iModel = 0; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 3c72cb80308..99f3782215d 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ namespace VMAP class TriBoundFunc { public: - TriBoundFunc(std::vector<Vector3> &vert): vertices(vert.begin()) {} + TriBoundFunc(std::vector<Vector3> &vert): vertices(vert.begin()) { } void operator()(const MeshTriangle &tri, G3D::AABox &out) const { G3D::Vector3 lo = vertices[tri.idx0]; @@ -360,7 +360,7 @@ namespace VMAP struct GModelRayCallback { GModelRayCallback(const std::vector<MeshTriangle> &tris, const std::vector<Vector3> &vert): - vertices(vert.begin()), triangles(tris.begin()), hit(false) {} + vertices(vert.begin()), triangles(tris.begin()), hit(false) { } bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/) { bool result = IntersectTriangle(triangles[entry], vertices, ray, distance); @@ -420,7 +420,7 @@ namespace VMAP struct WModelRayCallBack { - WModelRayCallBack(const std::vector<GroupModel> &mod): models(mod.begin()), hit(false) {} + WModelRayCallBack(const std::vector<GroupModel> &mod): models(mod.begin()), hit(false) { } bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit) { bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit); @@ -446,7 +446,7 @@ namespace VMAP class WModelAreaCallback { public: WModelAreaCallback(const std::vector<GroupModel> &vals, const Vector3 &down): - prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) {} + prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) { } std::vector<GroupModel>::const_iterator prims; std::vector<GroupModel>::const_iterator hit; float minVol; diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index 9d588316cce..8778998a6b7 100644 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it @@ -36,8 +36,8 @@ namespace VMAP class MeshTriangle { public: - MeshTriangle(){} - MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) {} + MeshTriangle() : idx0(0), idx1(0), idx2(0) { } + MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) { } uint32 idx0; uint32 idx1; @@ -59,7 +59,7 @@ namespace VMAP bool writeToFile(FILE* wf); static bool readFromFile(FILE* rf, WmoLiquid* &liquid); private: - WmoLiquid(): iHeight(0), iFlags(0) {} + WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(0), iFlags(0) { } uint32 iTilesX; //!< number of tiles in x direction, each uint32 iTilesY; G3D::Vector3 iCorner; //!< the lower corner @@ -74,10 +74,10 @@ namespace VMAP class GroupModel { public: - GroupModel(): iLiquid(0) {} + GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(0) { } GroupModel(const GroupModel &other); GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound): - iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) {} + iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) { } ~GroupModel() { delete iLiquid; } //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! @@ -107,7 +107,7 @@ namespace VMAP class WorldModel { public: - WorldModel(): RootWMOID(0) {} + WorldModel(): RootWMOID(0) { } //! pass group models to WorldModel and create BIH. Passed vector is swapped with old geometry! void setGroupModels(std::vector<GroupModel> &models); diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index f51fdcc2d2b..0bc74df51ec 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it diff --git a/src/server/collision/VMapTools.h b/src/server/collision/VMapTools.h index 5aefda6deb4..3951955a446 100644 --- a/src/server/collision/VMapTools.h +++ b/src/server/collision/VMapTools.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify it |
