From d0ee13ac0ac341b2c35b6957074f2e9bbc85bd4e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 10 Aug 2020 09:56:31 +0800 Subject: [PATCH] 1 --- server/gameserver/mapservice.cc | 9 +++++++++ server/gameserver/mapservice.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/server/gameserver/mapservice.cc b/server/gameserver/mapservice.cc index 6e3483b..f9dcae7 100644 --- a/server/gameserver/mapservice.cc +++ b/server/gameserver/mapservice.cc @@ -3,6 +3,11 @@ #include #include +#include "DetourNavMeshBuilder.h" +#include "DetourNavMeshQuery.h" +#include "DetourCommon.h" +#include "DetourNavMesh.h" + #include "mapservice.h" #include "collider.h" #include "entity.h" @@ -33,6 +38,10 @@ MapService::~MapService() free(map_cells_); map_cells_ = nullptr; } + if (navmesh_) { + dtFreeNavMesh(navmesh_); + navmesh_ = nullptr; + } } void MapService::Init(int width, int height, int cell_width) diff --git a/server/gameserver/mapservice.h b/server/gameserver/mapservice.h index 27e48e5..cca1b6c 100644 --- a/server/gameserver/mapservice.h +++ b/server/gameserver/mapservice.h @@ -54,6 +54,7 @@ struct FindPathStatus }; class Room; +class dtNavMesh; class MapService { public: @@ -87,6 +88,7 @@ class MapService bool IsValidPos(int x, int y); private: + dtNavMesh* navmesh_ = nullptr; list_head* map_cells_ = nullptr; int map_width_ = 0; int map_height_ = 0;