MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AIPathGetDPathSlot

Function AIPathGetDPathSlot

Descent3/aipath.cpp:552–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

550}
551
552static bool AIPathGetDPathSlot(int *slot, int handle) {
553 int i;
554
555 for (i = 0; i < MAX_DYNAMIC_PATHS; i++) {
556 if (!AIDynamicPath[i].use_count) {
557 AIDynamicPath[i].use_count++;
558 *slot = i;
559 AIDynamicPath[i].owner_handle = handle;
560 return true;
561 } else if (ObjGet(AIDynamicPath[i].owner_handle) == NULL && AIDynamicPath[i].use_count == 1) {
562 AIPathFreeDPathSlot(i);
563
564 AIDynamicPath[i].use_count++;
565 *slot = i;
566 AIDynamicPath[i].owner_handle = handle;
567 return true;
568 }
569 }
570
571 mprintf(0, "Out of dynamic paths");
572 ASSERT(0); // -- get chris
573 return false;
574}
575
576bool AIPathInitPath(ai_path_info *aip) {
577 ASSERT(aip);

Callers 1

AIPathAddDPathFunction · 0.85

Calls 2

ObjGetFunction · 0.85
AIPathFreeDPathSlotFunction · 0.85

Tested by

no test coverage detected