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.
This commit is contained in:
Kawe Mazidjatari 2024-11-03 15:21:25 +01:00
parent b4e7bb7886
commit d0a8549dc9
2 changed files with 3 additions and 3 deletions

View File

@ -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)
{

View File

@ -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)
{