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

Function EBNode_ComputeEdgeCosts

editor/ebnode.cpp:1291–1322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1289}
1290
1291void EBNode_ComputeEdgeCosts(int sroom, int spnt, int eroom, int epnt) {
1292 int i, j;
1293 bool f_found = false;
1294
1295 bn_list *snlist;
1296 snlist = BNode_GetBNListPtr(sroom);
1297 bn_list *enlist;
1298 enlist = BNode_GetBNListPtr(eroom);
1299
1300 for (i = 0; i < snlist->nodes[spnt].num_edges; i++) {
1301 for (j = 0; j < enlist->nodes[epnt].num_edges; j++) {
1302 if ((snlist->nodes[spnt].edges[i].end_index == epnt && snlist->nodes[spnt].edges[i].end_room == eroom) &&
1303 (enlist->nodes[epnt].edges[j].end_index == spnt && enlist->nodes[epnt].edges[j].end_room == sroom)) {
1304 f_found = true;
1305
1306 float cost = vm_VectorDistance(&snlist->nodes[spnt].pos, &enlist->nodes[epnt].pos);
1307 if (cost < 1.0f)
1308 cost = 1.0f;
1309
1310 int16_t scost = (cost < 32767.0f) ? (int16_t)cost : (int16_t)32767;
1311
1312 snlist->nodes[spnt].edges[i].cost = scost;
1313 enlist->nodes[epnt].edges[j].cost = scost;
1314
1315 snlist->nodes[spnt].edges[i].max_rad = enlist->nodes[epnt].edges[j].max_rad =
1316 EBNode_DetermineMaxSizeForEdge(spnt, sroom, epnt, eroom);
1317 }
1318 }
1319 }
1320
1321 ASSERT(f_found == true); // If you get this -- Get Chris!!!!!!!
1322}
1323
1324void EBNode_Move(bool f_offset, int roomnum, int pnt, vector *pos) {
1325 bn_list *nlist;

Callers 1

EBNode_MoveFunction · 0.85

Calls 3

BNode_GetBNListPtrFunction · 0.85
vm_VectorDistanceFunction · 0.50

Tested by

no test coverage detected