Provide better feedback when dtNavMesh::addTile fails due to a tile already being present at a given x,y

This commit is contained in:
cexikitin 2018-01-09 14:05:47 -05:00 committed by Jakob Botsch Nielsen
parent 367065415c
commit 05dd77db19
2 changed files with 2 additions and 1 deletions

View File

@ -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.

View File

@ -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;