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

Function GoalPathComplete

Descent3/AIGoal.cpp:838–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838void GoalPathComplete(object *obj) {
839 ai_frame *ai_info = obj->ai_info;
840 goal *cur_goal = GoalGetCurrentGoal(obj);
841
842 if (!cur_goal)
843 return;
844
845 if (COMPLETEATOBJ(cur_goal)) {
846 int handle = cur_goal->g_info.handle;
847 object *goal_obj = ObjGet(handle);
848
849 if ((goal_obj) && (cur_goal->g_info.pos != goal_obj->pos)) {
850 int ignore_obj = OBJNUM(goal_obj);
851
852 if (AIPathAllocPath(obj, ai_info, cur_goal, &obj->roomnum, &obj->pos, &goal_obj->roomnum, &goal_obj->pos, 0.0f, 0,
853 obj->handle, ignore_obj)) {
854 cur_goal->next_path_time = Gametime + MIN_NEXT_PATH_INTERVAL + ps_rand() / (float)D3_RAND_MAX;
855 }
856 } else {
857 GoalClearGoal(obj, cur_goal, AIN_GOAL_COMPLETE);
858 }
859 } else {
860 GoalClearGoal(obj, cur_goal, AIN_GOAL_COMPLETE);
861 }
862}
863
864void GoalClearAll(object *obj) {
865 int i;

Callers 1

AIPathCompleteFunction · 0.85

Calls 5

GoalGetCurrentGoalFunction · 0.85
ObjGetFunction · 0.85
AIPathAllocPathFunction · 0.85
ps_randFunction · 0.85
GoalClearGoalFunction · 0.85

Tested by

no test coverage detected