aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/collision/Management/MMapManager.cpp30
-rwxr-xr-xsrc/server/game/Maps/Map.cpp6
-rw-r--r--src/server/game/Movement/MovementGenerators/PathFinderMovementGenerator.cpp6
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp21
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h18
-rwxr-xr-xsrc/server/game/World/World.cpp4
-rw-r--r--src/tools/mmaps_generator/TerrainBuilder.h2
7 files changed, 40 insertions, 47 deletions
diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp
index 449abcb967d..0222f1a5995 100644
--- a/src/server/collision/Management/MMapManager.cpp
+++ b/src/server/collision/Management/MMapManager.cpp
@@ -60,14 +60,14 @@ namespace MMAP
if (DT_SUCCESS != mesh->init(&params))
{
dtFreeNavMesh(mesh);
- sLog->outError("MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName);
delete [] fileName;
return false;
}
delete [] fileName;
- sLog->outDetail("MMAP:loadMapData: Loaded %03i.mmap", mapId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:loadMapData: Loaded %03i.mmap", mapId);
// store inside our map list
MMapData* mmap_data = new MMapData(mesh);
@@ -118,13 +118,13 @@ namespace MMAP
if (fileHeader.mmapMagic != MMAP_MAGIC)
{
- sLog->outError("MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, y, x);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, y, x);
return false;
}
if (fileHeader.mmapVersion != MMAP_VERSION)
{
- sLog->outError("MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i",
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i",
mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION);
return false;
}
@@ -135,7 +135,7 @@ namespace MMAP
size_t result = fread(data, fileHeader.size, 1, file);
if (!result)
{
- sLog->outError("MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, y, x);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, y, x);
fclose(file);
return false;
}
@@ -150,12 +150,12 @@ namespace MMAP
{
mmap->mmapLoadedTiles.insert(std::pair<uint32, dtTileRef>(packedGridPos, tileRef));
++loadedTiles;
- sLog->outDetail("MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, y, x, mapId, header->x, header->y);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, y, x, mapId, header->x, header->y);
return true;
}
else
{
- sLog->outError("MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, y, x);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, y, x);
dtFree(data);
return false;
}
@@ -192,14 +192,14 @@ 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
- sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, y, x);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, y, x);
ASSERT(false);
}
else
{
mmap->mmapLoadedTiles.erase(packedGridPos);
--loadedTiles;
- sLog->outDetail("MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, y, x, mapId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, y, x, mapId);
return true;
}
@@ -222,17 +222,17 @@ namespace MMAP
uint32 x = (i->first >> 16);
uint32 y = (i->first & 0x0000FFFF);
if (DT_SUCCESS != mmap->navMesh->removeTile(i->second, NULL, NULL))
- sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, y, x);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, y, x);
else
{
--loadedTiles;
- sLog->outDetail("MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, y, x, mapId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, y, x, mapId);
}
}
delete mmap;
loadedMMaps.erase(mapId);
- sLog->outDetail("MMAP:unloadMap: Unloaded %03i.mmap", mapId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded %03i.mmap", mapId);
return true;
}
@@ -258,7 +258,7 @@ namespace MMAP
dtFreeNavMeshQuery(query);
mmap->navMeshQueries.erase(instanceId);
- sLog->outDetail("MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId);
return true;
}
@@ -285,11 +285,11 @@ namespace MMAP
if (DT_SUCCESS != query->init(mmap->navMesh, 1024))
{
dtFreeNavMeshQuery(query);
- sLog->outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
+ sLog->outError(LOG_FILTER_MAPS, "MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
return NULL;
}
- sLog->outDetail("MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
mmap->navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query));
}
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 80668d23ed8..c960d8123fe 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -126,10 +126,10 @@ void Map::LoadMMap(int gx, int gy)
// DONT CHANGE "gy" and "gx" - Its necessary !
bool mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap((sWorld->GetDataPath() + "mmaps").c_str(), GetId(), gy, gx);
- if (result)
- sLog->outDetail("MMAP loaded name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ if (mmapLoadResult)
+ sLog->outInfo(LOG_FILTER_MAPS, "MMAP loaded name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
else
- sLog->outDetail("Could not load MMAP name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outInfo(LOG_FILTER_MAPS, "Could not load MMAP name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
}
void Map::LoadVMap(int gx, int gy)
diff --git a/src/server/game/Movement/MovementGenerators/PathFinderMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathFinderMovementGenerator.cpp
index 82dcbc07648..8988aa599da 100644
--- a/src/server/game/Movement/MovementGenerators/PathFinderMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PathFinderMovementGenerator.cpp
@@ -88,7 +88,7 @@ bool PathFinderMovementGenerator::calculate(float destX, float destY, float dest
{
// our target is not moving - we just coming closer
// we are moving on precalculated path - enjoy the ride
- sLog->outStaticDebug("++ PathFinderMovementGenerator::calculate:: precalculated path\n");
+ sLog->outDebug(LOG_FILTER_MAPS, "++ PathFinderMovementGenerator::calculate:: precalculated path\n");
m_pathPoints.erase(m_pathPoints.begin());
return false;
@@ -367,7 +367,7 @@ void PathFinderMovementGenerator::BuildPolyPath(const Vector3 &startPos, const V
// this is probably an error state, but we'll leave it
// and hopefully recover on the next Update
// we still need to copy our preffix
- sLog->outError("%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow());
}
sLog->outDebug(LOG_FILTER_MAPS, "++ m_polyLength=%u prefixPolyLength=%u suffixPolyLength=%u \n",m_polyLength, prefixPolyLength, suffixPolyLength);
@@ -399,7 +399,7 @@ void PathFinderMovementGenerator::BuildPolyPath(const Vector3 &startPos, const V
if (!m_polyLength || dtResult != DT_SUCCESS)
{
// only happens if we passed bad data to findPath(), or navmesh is messed up
- sLog->outError("%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "%u's Path Build failed: 0 length path", m_sourceUnit->GetGUIDLow());
BuildShortcut();
m_type = PATHFIND_NOPATH;
return;
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 5fca373503e..7452efc94ca 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -79,7 +79,7 @@ namespace Movement
// should i do the things that user should do? - no.
if (args.path.empty())
- return;
+ return 0;
// corrent first vertex
args.path[0] = real_position;
@@ -148,12 +148,21 @@ namespace Movement
args.flags.EnableFacingAngle();
}
- void MoveSplineInit::MoveTo(Vector3 const& dest)
+ void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
{
- args.path_Idx_offset = 0;
- args.path.resize(2);
- TransportPathTransform transform(unit, args.TransformForTransport);
- args.path[1] = transform(dest);
+ if (generatePath)
+ {
+ PathFinderMovementGenerator path(&unit);
+ path.calculate(dest.x, dest.y, dest.z, forceDestination);
+ MovebyPath(path.getPath());
+ }
+ else
+ {
+ args.path_Idx_offset = 0;
+ args.path.resize(2);
+ TransportPathTransform transform(unit, args.TransformForTransport);
+ args.path[1] = transform(dest);
+ }
}
Vector3 TransportPathTransform::operator()(Vector3 input)
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index 740914c59db..9130d2827e6 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -161,26 +161,10 @@ namespace Movement
inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
{
- Vector3 v(x,y,z);
+ Vector3 v(x, y, z);
MoveTo(v, generatePath, forceDestination);
}
- inline void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
- {
- if (generatePath)
- {
- PathFinderMovementGenerator path(&unit);
- path.calculate(dest.x, dest.y, dest.z, forceDestination);
- MovebyPath(path.getPath());
- }
- else
- {
- args.path_Idx_offset = 0;
- args.path.resize(2);
- args.path[1] = dest;
- }
- }
-
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)
{
args.time_perc = time_shift;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 0d55d7a52e8..dee1b6dcdb8 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1125,8 +1125,8 @@ void World::LoadConfigSettings(bool reload)
}
m_bool_configs[CONFIG_ENABLE_MMAPS] = ConfigMgr::GetBoolDefault("mmap.enablePathFinding", true);
- sLog->outString("WORLD: MMap data directory is: %smmaps", m_dataPath.c_str());
- MMap::MMapFactory::preventPathfindingOnMaps(ConfigMgr::GetStringDefault("mmap.ignoreMapIds", "").c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "WORLD: MMap data directory is: %smmaps", m_dataPath.c_str());
+ MMAP::MMapFactory::preventPathfindingOnMaps(ConfigMgr::GetStringDefault("mmap.ignoreMapIds", "").c_str());
m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0);
bool enableIndoor = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", true);
diff --git a/src/tools/mmaps_generator/TerrainBuilder.h b/src/tools/mmaps_generator/TerrainBuilder.h
index a7f21883af2..6d478753279 100644
--- a/src/tools/mmaps_generator/TerrainBuilder.h
+++ b/src/tools/mmaps_generator/TerrainBuilder.h
@@ -62,7 +62,7 @@ namespace MMAP
// see following files:
// contrib/extractor/system.cpp
// src/game/Map.cpp
- static char const* MAP_VERSION_MAGIC = "v1.2";
+ static char const* MAP_VERSION_MAGIC = "v1.3";
struct MeshData
{