Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KitRifty committed Aug 2, 2023
1 parent c9fca82 commit 0409b81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extension/natives/nav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ cell_t CollectAreasAlongLine(IPluginContext* context, const cell_t* params) {
CUtlVector<CNavArea*> *pCollector = new CUtlVector<CNavArea*>;
CCollectorAddToTail addToTail(pCollector);

*(bool*)(reachedEndAddr) = ToolsNavMesh->ForAllAreasAlongLine(addToTail, startArea, endArea);
*reachedEndAddr = ToolsNavMesh->ForAllAreasAlongLine(addToTail, startArea, endArea) ? 1 : 0;
return CREATEHANDLE(SurroundingAreasCollector, pCollector);
}

Expand Down
12 changes: 4 additions & 8 deletions extension/natives/nav/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,13 @@ cell_t GetAdjacentLength(IPluginContext* context, const cell_t* params) {

NavDirType dir = (NavDirType)params[2];
if (dir < 0 || dir >= NUM_DIRECTIONS) {
context->ReportError("Invalid direction %d", dir);
return 0;
return context->ThrowNativeError("Invalid direction %d", dir);
}

int i = params[3];
const NavConnectVector *adjacent = area->GetAdjacentAreas(dir);
if (i < 0 || i >= adjacent->Count()) {
context->ReportError("Array index %d is out of bounds (array size: %d)", i, adjacent->Count());
return 0;
return context->ThrowNativeError("Array index %d is out of bounds (array size: %d)", i, adjacent->Count());
}

return sp_ftoc(adjacent->Element(i).length);
Expand Down Expand Up @@ -632,15 +630,13 @@ cell_t GetIncomingConnectionLength(IPluginContext* context, const cell_t* params

NavDirType dir = (NavDirType)params[2];
if (dir < 0 || dir >= NUM_DIRECTIONS) {
context->ReportError("Invalid direction %d", dir);
return 0;
return context->ThrowNativeError("Invalid direction %d", dir);
}

int i = params[3];
const NavConnectVector *incoming = area->GetIncomingConnections(dir);
if (i < 0 || i >= incoming->Count()) {
context->ReportError("Array index %d is out of bounds (array size: %d)", i, incoming->Count());
return 0;
return context->ThrowNativeError("Array index %d is out of bounds (array size: %d)", i, incoming->Count());
}

return sp_ftoc(incoming->Element(i).length);
Expand Down

0 comments on commit 0409b81

Please sign in to comment.