Recast: fix a few more incorrect variable names (XZY -> XYZ)

Missed during XZY -> XYZ conversion. No logic in code was changed.
This commit is contained in:
Kawe Mazidjatari 2024-07-13 13:09:54 +02:00
parent 492fea89f6
commit 975fa0ebbe
2 changed files with 10 additions and 10 deletions

View File

@ -532,14 +532,14 @@ static bool walkContour(dtTileCacheLayer& layer, int x, int y, dtTempContour& co
static float distancePtSeg(const int x, const int y, static float distancePtSeg(const int x, const int y,
const int px, const int py, const int px, const int py,
const int qx, const int qz) const int qx, const int qy)
{ {
float pqx = (float)(qx - px); float pqx = (float)(qx - px);
float pqz = (float)(qz - py); float pqy = (float)(qy - py);
float dx = (float)(x - px); float dx = (float)(x - px);
float dy = (float)(y - py); float dy = (float)(y - py);
float d = pqx*pqx + pqz*pqz; float d = pqx*pqx + pqy*pqy;
float t = pqx*dx + pqz*dy; float t = pqx*dx + pqy*dy;
if (d > 0) if (d > 0)
t /= d; t /= d;
if (t < 0) if (t < 0)
@ -548,7 +548,7 @@ static float distancePtSeg(const int x, const int y,
t = 1; t = 1;
dx = px + t*pqx - x; dx = px + t*pqx - x;
dy = py + t*pqz - y; dy = py + t*pqy - y;
return dx*dx + dy*dy; return dx*dx + dy*dy;
} }

View File

@ -482,12 +482,12 @@ bool rcBuildCompactHeightfield(rcContext* context, const int walkableHeight, con
// Find neighbour connections. // Find neighbour connections.
const int MAX_LAYERS = RC_NOT_CONNECTED - 1; const int MAX_LAYERS = RC_NOT_CONNECTED - 1;
int maxLayerIndex = 0; int maxLayerIndex = 0;
const int zStride = xSize; // for readability const int yStride = xSize; // for readability
for (int y = 0; y < ySize; ++y) for (int y = 0; y < ySize; ++y)
{ {
for (int x = 0; x < xSize; ++x) for (int x = 0; x < xSize; ++x)
{ {
const rcCompactCell& cell = compactHeightfield.cells[x + y * zStride]; const rcCompactCell& cell = compactHeightfield.cells[x + y * yStride];
for (int i = (int)cell.index, ni = (int)(cell.index + cell.count); i < ni; ++i) for (int i = (int)cell.index, ni = (int)(cell.index + cell.count); i < ni; ++i)
{ {
rcCompactSpan& span = compactHeightfield.spans[i]; rcCompactSpan& span = compactHeightfield.spans[i];
@ -496,16 +496,16 @@ bool rcBuildCompactHeightfield(rcContext* context, const int walkableHeight, con
{ {
rcSetCon(span, dir, RC_NOT_CONNECTED); rcSetCon(span, dir, RC_NOT_CONNECTED);
const int neighborX = x + rcGetDirOffsetX(dir); const int neighborX = x + rcGetDirOffsetX(dir);
const int neighborZ = y + rcGetDirOffsetY(dir); const int neighborY = y + rcGetDirOffsetY(dir);
// First check that the neighbour cell is in bounds. // First check that the neighbour cell is in bounds.
if (neighborX < 0 || neighborZ < 0 || neighborX >= xSize || neighborZ >= ySize) if (neighborX < 0 || neighborY < 0 || neighborX >= xSize || neighborY >= ySize)
{ {
continue; continue;
} }
// Iterate over all neighbour spans and check if any of the is // Iterate over all neighbour spans and check if any of the is
// accessible from current cell. // accessible from current cell.
const rcCompactCell& neighborCell = compactHeightfield.cells[neighborX + neighborZ * zStride]; const rcCompactCell& neighborCell = compactHeightfield.cells[neighborX + neighborY * yStride];
for (int k = (int)neighborCell.index, nk = (int)(neighborCell.index + neighborCell.count); k < nk; ++k) for (int k = (int)neighborCell.index, nk = (int)(neighborCell.index + neighborCell.count); k < nk; ++k)
{ {
const rcCompactSpan& neighborSpan = compactHeightfield.spans[k]; const rcCompactSpan& neighborSpan = compactHeightfield.spans[k];