diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index 52d91861..56d07f60 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -144,7 +144,7 @@ void MapInstance::Init() } #if 1 { - dtTileRef tile_ref = navmesh_->getTileRefAt(10, 10, 0); + dtTileRef tile_ref = navmesh_->getTileRefAt(0, 0, 0); int i = 0; } #endif @@ -621,3 +621,28 @@ a8::Vec2* MapInstance::GetSpawnPoint(const std::string& name) auto itr = spawn_name_hash_.find(name); return itr != spawn_name_hash_.end() ? &itr->second : nullptr; } + +int MapInstance::FindStraightPath(int layer, + const a8::Vec3& start, + const a8::Vec3& end, + std::vector& paths) +{ + return 0; +} + +int MapInstance::FindRandomPointAroundCircle(int layer, + const a8::Vec3& center_pos, + std::vector& points, + unsigned int max_points, + float max_radius) +{ + return 0; +} + +int MapInstance::Raycast(int layer, + const a8::Vec3& start, + const a8::Vec3& end, + std::vector& hit_points) +{ + return 0; +} diff --git a/server/gameserver/mapinstance.h b/server/gameserver/mapinstance.h index 6dfae90b..6dfe0597 100644 --- a/server/gameserver/mapinstance.h +++ b/server/gameserver/mapinstance.h @@ -1,6 +1,10 @@ #pragma once #include "DetourNavMesh.h" +#include "DetourNavMeshQuery.h" + +#include +#include namespace MetaData { @@ -33,7 +37,22 @@ class MapInstance MetaData::Map* GetMapMeta() { return map_meta_; } Entity* GetEntityByUniId(int uniid); a8::Vec2* GetSpawnPoint(const std::string& name); + dtNavMesh* GetNavMesh() { return navmesh_; }; + dtNavMeshQuery* GetNavMeshQuery() { return navmesh_query_; }; + int FindStraightPath(int layer, + const a8::Vec3& start, + const a8::Vec3& end, + std::vector& paths); + int FindRandomPointAroundCircle(int layer, + const a8::Vec3& center_pos, + std::vector& points, + unsigned int max_points, + float max_radius); + int Raycast(int layer, + const a8::Vec3& start, + const a8::Vec3& end, + std::vector& hit_points); private: void CreateThings(); @@ -52,6 +71,7 @@ class MapInstance private: dtNavMesh* navmesh_ = nullptr; + dtNavMeshQuery* navmesh_query_ = nullptr; int current_uniid_ = 0; int current_map_block_uniid_ = 0;