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

Function MakeTestPath

Descent3/aipath.cpp:1201–1239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199vector AIPath_test_end_pos = {0, 0, 0};
1200
1201bool MakeTestPath(int *start_room, vector *pos) {
1202 bool status;
1203 ai_frame ai_info;
1204 int count = 0;
1205
1206 ai_info.awareness = AWARE_MOSTLY;
1207
1208 AIPathInitPath(&ai_info.path);
1209
1210 status = AIPathAllocPath(NULL, &ai_info, &ai_info.goals[0], start_room, pos, &AIPath_test_end_room,
1211 &AIPath_test_end_pos, 0.0f, 0, 0);
1212
1213 while (status) {
1214 vector pos;
1215 int room;
1216
1217 status = AIPathGetCurrentNodePos(&ai_info.path, &pos, &room);
1218
1219 if (status) {
1220 int id = FindObjectIDName("Shield");
1221 ObjCreate(OBJ_POWERUP, id, room, &pos, &Identity_matrix);
1222 count++;
1223 }
1224
1225 status = AIPathMoveToNextNode(&ai_info.path);
1226 }
1227
1228 AddHUDMessage("The test path has %d nodes.", count);
1229
1230 // #ifdef _DEBUG
1231 // if(AI_debug_robot_do && OBJNUM(obj) == AI_debug_robot_index)
1232 // {
1233 // mprintf(0, "AI Note: In free path\n");
1234 // }
1235 // #endif
1236 AIPathFreePath(&ai_info.path);
1237
1238 return true;
1239}
1240
1241#endif

Callers 1

ProcessTestKeysFunction · 0.85

Calls 8

AIPathInitPathFunction · 0.85
AIPathAllocPathFunction · 0.85
AIPathGetCurrentNodePosFunction · 0.85
FindObjectIDNameFunction · 0.85
ObjCreateFunction · 0.85
AIPathMoveToNextNodeFunction · 0.85
AddHUDMessageFunction · 0.85
AIPathFreePathFunction · 0.85

Tested by

no test coverage detected