From 05dd77db196961704de7df1cd103884918fac612 Mon Sep 17 00:00:00 2001 From: cexikitin Date: Tue, 9 Jan 2018 14:05:47 -0500 Subject: [PATCH] Provide better feedback when dtNavMesh::addTile fails due to a tile already being present at a given x,y --- Detour/Include/DetourStatus.h | 1 + Detour/Source/DetourNavMesh.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Detour/Include/DetourStatus.h b/Detour/Include/DetourStatus.h index af822c4..8e1bb44 100644 --- a/Detour/Include/DetourStatus.h +++ b/Detour/Include/DetourStatus.h @@ -35,6 +35,7 @@ static const unsigned int DT_INVALID_PARAM = 1 << 3; // An input parameter was i static const unsigned int DT_BUFFER_TOO_SMALL = 1 << 4; // Result buffer for the query was too small to store all results. static const unsigned int DT_OUT_OF_NODES = 1 << 5; // Query ran out of nodes during search. static const unsigned int DT_PARTIAL_RESULT = 1 << 6; // Query did not reach the end location, returning best guess. +static const unsigned int DT_ALREADY_OCCUPIED = 1 << 7; // A tile has already been assigned to the given x,y coordinate // Returns true of status is success. diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp index b81a256..17df26d 100644 --- a/Detour/Source/DetourNavMesh.cpp +++ b/Detour/Source/DetourNavMesh.cpp @@ -855,7 +855,7 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, // Make sure the location is free. if (getTileAt(header->x, header->y, header->layer)) - return DT_FAILURE; + return DT_FAILURE | DT_ALREADY_OCCUPIED; // Allocate a tile. dtMeshTile* tile = 0;