From d0a8549dc9f07b4f07a28066aad326ca50b9d5d0 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:21:25 +0100 Subject: [PATCH] Recast: change return type of tile side getters to unsigned char Value will never be higher than 7 as we only have 8 sides (0-7). Avoids having to cast as dtLink::side is an unsigned char. --- src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp | 2 +- src/thirdparty/recast/Shared/Include/SharedCommon.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp index 78662d59..8bc16e56 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp @@ -715,7 +715,7 @@ dtStatus dtNavMesh::connectOffMeshLinks(const dtTileRef tileRef) const int nneis = getTilesAt(tx, ty, neis, MAX_NEIS); const unsigned char side = rdClassifyPointOutsideBounds(&con->pos[3], header->bmin, header->bmax); - const unsigned char oppositeSide = (side == 0xff) ? 0xff : (unsigned char)rdOppositeTile(side); + const unsigned char oppositeSide = (side == 0xff) ? 0xff : rdOppositeTile(side); for (int j = 0; j < nneis; ++j) { diff --git a/src/thirdparty/recast/Shared/Include/SharedCommon.h b/src/thirdparty/recast/Shared/Include/SharedCommon.h index 166babbb..70b01878 100644 --- a/src/thirdparty/recast/Shared/Include/SharedCommon.h +++ b/src/thirdparty/recast/Shared/Include/SharedCommon.h @@ -617,8 +617,8 @@ inline unsigned int rdIlog2(unsigned int v) inline int rdAlign4(int x) { return (x+3) & ~3; } -inline int rdWrapTileSide(int side) { return side & 0x7; } -inline int rdOppositeTile(int side) { return rdWrapTileSide(side+4); } +inline unsigned char rdWrapTileSide(const int side) { return side & 0x7; } +inline unsigned char rdOppositeTile(const int side) { return rdWrapTileSide(side+4); } inline void rdSwapByte(unsigned char* a, unsigned char* b) {