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

Function AIFindRoomWithFlag

Descent3/AImain.cpp:6340–6364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6338}
6339
6340int AIFindRoomWithFlag(object *obj, int flag) {
6341 int cur_room = obj->roomnum;
6342 float best_dist = 0.0f;
6343 int best_room = -1;
6344 int i;
6345
6346 for (i = 0; i <= Highest_room_index; i++) {
6347 if ((Rooms[i].used) && (Rooms[i].flags & flag)) {
6348 float cur_dist;
6349
6350 if (BOA_ComputeMinDist(obj->roomnum, i, 0.0f, &cur_dist, NULL)) {
6351 if (best_room == -1 || cur_dist < best_dist) {
6352 bool f_path_exists = AIFindAltPath(obj, cur_room, i, &cur_dist);
6353
6354 if (f_path_exists && (best_room == -1 || cur_dist < best_dist)) {
6355 best_dist = cur_dist;
6356 best_room = i;
6357 }
6358 }
6359 }
6360 }
6361 }
6362
6363 return best_room;
6364}
6365
6366bool AIFindHidePos(object *hide_obj, object *view_obj, vector *hpos, int *hroom, float max_hide_time) { return false; }
6367

Callers 1

osipf_AIFindEnergyCenterFunction · 0.85

Calls 2

BOA_ComputeMinDistFunction · 0.85
AIFindAltPathFunction · 0.85

Tested by

no test coverage detected