| 561 | } |
| 562 | |
| 563 | void EBNode_RemoveNode(int roomnum, int pnt) { |
| 564 | int i; |
| 565 | |
| 566 | BNode_verified = false; |
| 567 | |
| 568 | bn_list *nlist; |
| 569 | nlist = BNode_GetBNListPtr(roomnum); |
| 570 | if (!nlist) |
| 571 | return; |
| 572 | |
| 573 | ASSERT(pnt >= 0 && pnt < nlist->num_nodes); |
| 574 | |
| 575 | // Remove all connects to the world... |
| 576 | for (i = nlist->nodes[pnt].num_edges - 1; i >= 0; i--) { |
| 577 | EBNode_RemoveEdge(pnt, roomnum, nlist->nodes[pnt].edges[i].end_index, nlist->nodes[pnt].edges[i].end_room); |
| 578 | } |
| 579 | |
| 580 | // Copy the nodes down the list |
| 581 | for (i = pnt; i < nlist->num_nodes - 1; i++) { |
| 582 | nlist->nodes[i] = nlist->nodes[i + 1]; |
| 583 | } |
| 584 | |
| 585 | nlist->num_nodes--; |
| 586 | |
| 587 | if (nlist->num_nodes == 0) { |
| 588 | mem_free(nlist->nodes); |
| 589 | nlist->nodes = NULL; |
| 590 | } else { |
| 591 | nlist->nodes = (bn_node *)mem_realloc(nlist->nodes, sizeof(bn_node) * nlist->num_nodes); |
| 592 | } |
| 593 | |
| 594 | // Not super efficient, but works. :) |
| 595 | int next_rooms[1000]; |
| 596 | int num_next_rooms = AIMakeNextRoomList(roomnum, next_rooms, 1000); |
| 597 | |
| 598 | for (i = 0; i < num_next_rooms; i++) { |
| 599 | RemapEdgeNodesEqualAndAbove(next_rooms[i], roomnum, pnt); |
| 600 | } |
| 601 | RemapEdgeNodesEqualAndAbove(roomnum, roomnum, pnt); |
| 602 | RemapPortalNodeIndices(roomnum, pnt); |
| 603 | } |
| 604 | |
| 605 | void EBNode_RemoveEdge(int spnt, int sroom, int epnt, int eroom, bool f_remove_reverse) { |
| 606 | int i; |
no test coverage detected