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;