Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d3: fix game crash in Retribution level 12's big matcen room #648

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Descent3/BOA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ int BOA_DetermineStartRoomPortal(int start_room, vector *start_pos, int end_room
bool f_making_robot_path_invalid_list, int *blocked_portal) {
int i;

if (start_room == -1 || end_room == -1)
return -1;
if (start_room > Highest_room_index && end_room > Highest_room_index)
return -1;

Expand Down Expand Up @@ -566,12 +568,12 @@ int BOA_GetNextRoom(int start_room, int end_room) {
int e_index = end_room;

if (start_room == -1 || end_room == -1) {
return false;
return BOA_NO_PATH;
}

if ((!ROOMNUM_OUTSIDE(s_index)) && s_index <= Highest_room_index) {
if (!Rooms[s_index].used) {
return false;
return BOA_NO_PATH;
}
} else if (ROOMNUM_OUTSIDE(s_index)) {
s_index = TERRAIN_REGION(start_room) + Highest_room_index + 1;
Expand All @@ -581,7 +583,7 @@ int BOA_GetNextRoom(int start_room, int end_room) {

if ((!ROOMNUM_OUTSIDE(e_index)) && e_index <= Highest_room_index) {
if (!Rooms[e_index].used) {
return false;
return BOA_NO_PATH;
}
} else if (ROOMNUM_OUTSIDE(e_index)) {
e_index = TERRAIN_REGION(end_room) + Highest_room_index + 1;
Expand Down
2 changes: 2 additions & 0 deletions Descent3/aipath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ static void AIUpdatePathInfo(q_item **node_list, int start, int end) {

// Ok to use Highest_room_index offset stuff
bool AIFindAltPath(object *obj, int i, int j, float *dist) {
if (i == -1 || j == -1)
return false;
i = BOA_INDEX(i);
j = BOA_INDEX(j);

Expand Down
5 changes: 5 additions & 0 deletions Descent3/bnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ static void BNode_UpdatePathInfo(pq_item **node_list, int start, int end) {

// Ok to use Highest_room_index offset stuff
bool BNode_FindPath(int start_room, int i, int j, float rad) {
if (start_room == -1)
return false;
bpq PQPath;
int counter;
pq_item *start_node = new pq_item(i, -1, 0.0f);
Expand Down Expand Up @@ -311,6 +313,8 @@ int BNode_FindDirLocalVisibleBNode(int roomnum, vector *pos, vector *fvec, float
}

bn_list *bnlist = BNode_GetBNListPtr(roomnum);
if (bnlist == nullptr)
return -1;

retry:

Expand Down Expand Up @@ -402,6 +406,7 @@ int BNode_FindClosestLocalVisibleBNode(int roomnum, vector *pos, float rad) {
}

bn_list *bnlist = BNode_GetBNListPtr(roomnum);
ASSERT(bnlist);

retry:

Expand Down
Loading