From 2de6e56d29df8cebb358e10e5e452422588a3929 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 29 May 2021 14:48:18 +0200 Subject: Core/Misc: Rename MapDefines.h to MMapDefines.h as it contains mmap defines exclusively --- src/common/Collision/Management/MMapManager.cpp | 2 +- src/common/Collision/Maps/MMapDefines.h | 67 +++++++++++++++++++++++++ src/common/Collision/Maps/MapDefines.h | 67 ------------------------- src/server/game/Movement/PathGenerator.h | 2 +- src/tools/mmaps_generator/MapBuilder.cpp | 2 +- src/tools/mmaps_generator/TerrainBuilder.cpp | 2 +- 6 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 src/common/Collision/Maps/MMapDefines.h delete mode 100644 src/common/Collision/Maps/MapDefines.h (limited to 'src') diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp index e33ebf99c54..fc5f013a310 100644 --- a/src/common/Collision/Management/MMapManager.cpp +++ b/src/common/Collision/Management/MMapManager.cpp @@ -18,7 +18,7 @@ #include "MMapManager.h" #include "Errors.h" #include "Log.h" -#include "MapDefines.h" +#include "MMapDefines.h" namespace MMAP { diff --git a/src/common/Collision/Maps/MMapDefines.h b/src/common/Collision/Maps/MMapDefines.h new file mode 100644 index 00000000000..185eee7a935 --- /dev/null +++ b/src/common/Collision/Maps/MMapDefines.h @@ -0,0 +1,67 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * 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 . + */ + +#ifndef MMapDefines_h__ +#define MMapDefines_h__ + +#include "Define.h" +#include "DetourNavMesh.h" + +const uint32 MMAP_MAGIC = 0x4d4d4150; // 'MMAP' +#define MMAP_VERSION 10 + +struct MmapTileHeader +{ + uint32 mmapMagic; + uint32 dtVersion; + uint32 mmapVersion; + uint32 size; + char usesLiquids; + char padding[3]; + + MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION), + mmapVersion(MMAP_VERSION), size(0), usesLiquids(true), padding() { } +}; + +// All padding fields must be handled and initialized to ensure mmaps_generator will produce binary-identical *.mmtile files +static_assert(sizeof(MmapTileHeader) == 20, "MmapTileHeader size is not correct, adjust the padding field size"); +static_assert(sizeof(MmapTileHeader) == (sizeof(MmapTileHeader::mmapMagic) + + sizeof(MmapTileHeader::dtVersion) + + sizeof(MmapTileHeader::mmapVersion) + + sizeof(MmapTileHeader::size) + + sizeof(MmapTileHeader::usesLiquids) + + sizeof(MmapTileHeader::padding)), "MmapTileHeader has uninitialized padding fields"); + +enum NavArea +{ + NAV_AREA_EMPTY = 0, + // areas 1-60 will be used for destructible areas (currently skipped in vmaps, WMO with flag 1) + // ground is the highest value to make recast choose ground over water when merging surfaces very close to each other (shallow water would be walkable) + NAV_AREA_GROUND = 63, + NAV_AREA_WATER = 62, + NAV_AREA_MAGMA_SLIME = 61 // don't need to differentiate between them +}; + +enum NavTerrainFlag +{ + NAV_EMPTY = 0x00, + NAV_GROUND = 1 << (63 - NAV_AREA_GROUND), + NAV_WATER = 1 << (63 - NAV_AREA_WATER), + NAV_MAGMA_SLIME = 1 << (63 - NAV_AREA_MAGMA_SLIME) +}; + +#endif // MMapDefines_h__ diff --git a/src/common/Collision/Maps/MapDefines.h b/src/common/Collision/Maps/MapDefines.h deleted file mode 100644 index d433b381cc8..00000000000 --- a/src/common/Collision/Maps/MapDefines.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information - * - * 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 . - */ - -#ifndef _MAPDEFINES_H -#define _MAPDEFINES_H - -#include "Define.h" -#include "DetourNavMesh.h" - -const uint32 MMAP_MAGIC = 0x4d4d4150; // 'MMAP' -#define MMAP_VERSION 10 - -struct MmapTileHeader -{ - uint32 mmapMagic; - uint32 dtVersion; - uint32 mmapVersion; - uint32 size; - char usesLiquids; - char padding[3]; - - MmapTileHeader() : mmapMagic(MMAP_MAGIC), dtVersion(DT_NAVMESH_VERSION), - mmapVersion(MMAP_VERSION), size(0), usesLiquids(true), padding() { } -}; - -// All padding fields must be handled and initialized to ensure mmaps_generator will produce binary-identical *.mmtile files -static_assert(sizeof(MmapTileHeader) == 20, "MmapTileHeader size is not correct, adjust the padding field size"); -static_assert(sizeof(MmapTileHeader) == (sizeof(MmapTileHeader::mmapMagic) + - sizeof(MmapTileHeader::dtVersion) + - sizeof(MmapTileHeader::mmapVersion) + - sizeof(MmapTileHeader::size) + - sizeof(MmapTileHeader::usesLiquids) + - sizeof(MmapTileHeader::padding)), "MmapTileHeader has uninitialized padding fields"); - -enum NavArea -{ - NAV_AREA_EMPTY = 0, - // areas 1-60 will be used for destructible areas (currently skipped in vmaps, WMO with flag 1) - // ground is the highest value to make recast choose ground over water when merging surfaces very close to each other (shallow water would be walkable) - NAV_AREA_GROUND = 63, - NAV_AREA_WATER = 62, - NAV_AREA_MAGMA_SLIME = 61 // don't need to differentiate between them -}; - -enum NavTerrainFlag -{ - NAV_EMPTY = 0x00, - NAV_GROUND = 1 << (63 - NAV_AREA_GROUND), - NAV_WATER = 1 << (63 - NAV_AREA_WATER), - NAV_MAGMA_SLIME = 1 << (63 - NAV_AREA_MAGMA_SLIME) -}; - -#endif /* _MAPDEFINES_H */ diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h index 8109579dfbc..0030b62c62e 100644 --- a/src/server/game/Movement/PathGenerator.h +++ b/src/server/game/Movement/PathGenerator.h @@ -18,9 +18,9 @@ #ifndef _PATH_GENERATOR_H #define _PATH_GENERATOR_H -#include "MapDefines.h" #include "DetourNavMesh.h" #include "DetourNavMeshQuery.h" +#include "MMapDefines.h" #include "MoveSplineInitArgs.h" #include diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index fcf3f104ead..2bbdcd23c0e 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -16,8 +16,8 @@ */ #include "MapBuilder.h" -#include "MapDefines.h" #include "MapTree.h" +#include "MMapDefines.h" #include "ModelInstance.h" #include "PathCommon.h" #include "StringFormat.h" diff --git a/src/tools/mmaps_generator/TerrainBuilder.cpp b/src/tools/mmaps_generator/TerrainBuilder.cpp index 17b9d75ea0c..c9f0638fb1a 100644 --- a/src/tools/mmaps_generator/TerrainBuilder.cpp +++ b/src/tools/mmaps_generator/TerrainBuilder.cpp @@ -17,8 +17,8 @@ #include "TerrainBuilder.h" #include "MapBuilder.h" -#include "MapDefines.h" #include "MapTree.h" +#include "MMapDefines.h" #include "ModelInstance.h" #include "VMapFactory.h" #include "VMapManager2.h" -- cgit v1.2.3