mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-17 09:14:34 +00:00
fix(Core/Deps): Update recastnavigation to last version (#2189)
Note: you need to re-extract the client data files, or download them from: https://github.com/wowgaming/client-data/releases/tag/v7
This commit is contained in:
169
deps/recastnavigation/Recast/Source/Recast.cpp
vendored
169
deps/recastnavigation/Recast/Source/Recast.cpp
vendored
@@ -23,11 +23,34 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <new>
|
||||
#include "Recast.h"
|
||||
#include "RecastAlloc.h"
|
||||
#include "RecastAssert.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
/// Allocates and constructs an object of the given type, returning a pointer.
|
||||
/// TODO: Support constructor args.
|
||||
/// @param[in] hint Hint to the allocator.
|
||||
template <typename T>
|
||||
T* rcNew(rcAllocHint hint) {
|
||||
T* ptr = (T*)rcAlloc(sizeof(T), hint);
|
||||
::new(rcNewTag(), (void*)ptr) T();
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// Destroys and frees an object allocated with rcNew.
|
||||
/// @param[in] ptr The object pointer to delete.
|
||||
template <typename T>
|
||||
void rcDelete(T* ptr) {
|
||||
if (ptr) {
|
||||
ptr->~T();
|
||||
rcFree((void*)ptr);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
float rcSqrt(float x)
|
||||
{
|
||||
return sqrtf(x);
|
||||
@@ -73,9 +96,8 @@ void rcContext::log(const rcLogCategory category, const char* format, ...)
|
||||
|
||||
rcHeightfield* rcAllocHeightfield()
|
||||
{
|
||||
return new (rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM)) rcHeightfield;
|
||||
return rcNew<rcHeightfield>(RC_ALLOC_PERM);
|
||||
}
|
||||
|
||||
rcHeightfield::rcHeightfield()
|
||||
: width()
|
||||
, height()
|
||||
@@ -104,84 +126,133 @@ rcHeightfield::~rcHeightfield()
|
||||
|
||||
void rcFreeHeightField(rcHeightfield* hf)
|
||||
{
|
||||
if (!hf) return;
|
||||
hf->~rcHeightfield();
|
||||
rcFree(hf);
|
||||
rcDelete(hf);
|
||||
}
|
||||
|
||||
rcCompactHeightfield* rcAllocCompactHeightfield()
|
||||
{
|
||||
rcCompactHeightfield* chf = (rcCompactHeightfield*)rcAlloc(sizeof(rcCompactHeightfield), RC_ALLOC_PERM);
|
||||
memset(chf, 0, sizeof(rcCompactHeightfield));
|
||||
return chf;
|
||||
return rcNew<rcCompactHeightfield>(RC_ALLOC_PERM);
|
||||
}
|
||||
|
||||
void rcFreeCompactHeightfield(rcCompactHeightfield* chf)
|
||||
{
|
||||
if (!chf) return;
|
||||
rcFree(chf->cells);
|
||||
rcFree(chf->spans);
|
||||
rcFree(chf->dist);
|
||||
rcFree(chf->areas);
|
||||
rcFree(chf);
|
||||
rcDelete(chf);
|
||||
}
|
||||
|
||||
rcCompactHeightfield::rcCompactHeightfield()
|
||||
: width(),
|
||||
height(),
|
||||
spanCount(),
|
||||
walkableHeight(),
|
||||
walkableClimb(),
|
||||
borderSize(),
|
||||
maxDistance(),
|
||||
maxRegions(),
|
||||
bmin(),
|
||||
bmax(),
|
||||
cs(),
|
||||
ch(),
|
||||
cells(),
|
||||
spans(),
|
||||
dist(),
|
||||
areas()
|
||||
{
|
||||
}
|
||||
rcCompactHeightfield::~rcCompactHeightfield()
|
||||
{
|
||||
rcFree(cells);
|
||||
rcFree(spans);
|
||||
rcFree(dist);
|
||||
rcFree(areas);
|
||||
}
|
||||
|
||||
rcHeightfieldLayerSet* rcAllocHeightfieldLayerSet()
|
||||
{
|
||||
rcHeightfieldLayerSet* lset = (rcHeightfieldLayerSet*)rcAlloc(sizeof(rcHeightfieldLayerSet), RC_ALLOC_PERM);
|
||||
memset(lset, 0, sizeof(rcHeightfieldLayerSet));
|
||||
return lset;
|
||||
return rcNew<rcHeightfieldLayerSet>(RC_ALLOC_PERM);
|
||||
}
|
||||
|
||||
void rcFreeHeightfieldLayerSet(rcHeightfieldLayerSet* lset)
|
||||
{
|
||||
if (!lset) return;
|
||||
for (int i = 0; i < lset->nlayers; ++i)
|
||||
rcDelete(lset);
|
||||
}
|
||||
|
||||
rcHeightfieldLayerSet::rcHeightfieldLayerSet()
|
||||
: layers(), nlayers() {}
|
||||
rcHeightfieldLayerSet::~rcHeightfieldLayerSet()
|
||||
{
|
||||
for (int i = 0; i < nlayers; ++i)
|
||||
{
|
||||
rcFree(lset->layers[i].heights);
|
||||
rcFree(lset->layers[i].areas);
|
||||
rcFree(lset->layers[i].cons);
|
||||
rcFree(layers[i].heights);
|
||||
rcFree(layers[i].areas);
|
||||
rcFree(layers[i].cons);
|
||||
}
|
||||
rcFree(lset->layers);
|
||||
rcFree(lset);
|
||||
rcFree(layers);
|
||||
}
|
||||
|
||||
|
||||
rcContourSet* rcAllocContourSet()
|
||||
{
|
||||
rcContourSet* cset = (rcContourSet*)rcAlloc(sizeof(rcContourSet), RC_ALLOC_PERM);
|
||||
memset(cset, 0, sizeof(rcContourSet));
|
||||
return cset;
|
||||
return rcNew<rcContourSet>(RC_ALLOC_PERM);
|
||||
}
|
||||
|
||||
void rcFreeContourSet(rcContourSet* cset)
|
||||
{
|
||||
if (!cset) return;
|
||||
for (int i = 0; i < cset->nconts; ++i)
|
||||
{
|
||||
rcFree(cset->conts[i].verts);
|
||||
rcFree(cset->conts[i].rverts);
|
||||
}
|
||||
rcFree(cset->conts);
|
||||
rcFree(cset);
|
||||
rcDelete(cset);
|
||||
}
|
||||
|
||||
rcContourSet::rcContourSet()
|
||||
: conts(),
|
||||
nconts(),
|
||||
bmin(),
|
||||
bmax(),
|
||||
cs(),
|
||||
ch(),
|
||||
width(),
|
||||
height(),
|
||||
borderSize(),
|
||||
maxError() {}
|
||||
rcContourSet::~rcContourSet()
|
||||
{
|
||||
for (int i = 0; i < nconts; ++i)
|
||||
{
|
||||
rcFree(conts[i].verts);
|
||||
rcFree(conts[i].rverts);
|
||||
}
|
||||
rcFree(conts);
|
||||
}
|
||||
|
||||
|
||||
rcPolyMesh* rcAllocPolyMesh()
|
||||
{
|
||||
rcPolyMesh* pmesh = (rcPolyMesh*)rcAlloc(sizeof(rcPolyMesh), RC_ALLOC_PERM);
|
||||
memset(pmesh, 0, sizeof(rcPolyMesh));
|
||||
return pmesh;
|
||||
return rcNew<rcPolyMesh>(RC_ALLOC_PERM);
|
||||
}
|
||||
|
||||
void rcFreePolyMesh(rcPolyMesh* pmesh)
|
||||
{
|
||||
if (!pmesh) return;
|
||||
rcFree(pmesh->verts);
|
||||
rcFree(pmesh->polys);
|
||||
rcFree(pmesh->regs);
|
||||
rcFree(pmesh->flags);
|
||||
rcFree(pmesh->areas);
|
||||
rcFree(pmesh);
|
||||
rcDelete(pmesh);
|
||||
}
|
||||
|
||||
rcPolyMesh::rcPolyMesh()
|
||||
: verts(),
|
||||
polys(),
|
||||
regs(),
|
||||
flags(),
|
||||
areas(),
|
||||
nverts(),
|
||||
npolys(),
|
||||
maxpolys(),
|
||||
nvp(),
|
||||
bmin(),
|
||||
bmax(),
|
||||
cs(),
|
||||
ch(),
|
||||
borderSize(),
|
||||
maxEdgeError() {}
|
||||
|
||||
rcPolyMesh::~rcPolyMesh()
|
||||
{
|
||||
rcFree(verts);
|
||||
rcFree(polys);
|
||||
rcFree(regs);
|
||||
rcFree(flags);
|
||||
rcFree(areas);
|
||||
}
|
||||
|
||||
rcPolyMeshDetail* rcAllocPolyMeshDetail()
|
||||
|
||||
Reference in New Issue
Block a user