Merge pull request #63384 from lawnjelly/portals_room_hint_invalid

Portals - Fix invalid room hint when reconverting room graph
This commit is contained in:
Rémi Verschelde 2022-07-24 20:10:25 +02:00 committed by GitHub
commit 270f5a3bd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -102,6 +102,7 @@ int PortalRoomsBSP::find_room_within(const PortalRenderer &p_portal_renderer, co
// first try previous room
if (p_previous_room_id != -1) {
if (p_previous_room_id < p_portal_renderer.get_num_rooms()) {
const VSRoom &prev_room = p_portal_renderer.get_room(p_previous_room_id);
// we can only use this shortcut if the room doesn't include internal rooms.
@ -117,6 +118,10 @@ int PortalRoomsBSP::find_room_within(const PortalRenderer &p_portal_renderer, co
// don't mark it as checked later, as we haven't done it because it contains internal rooms
p_previous_room_id = -1;
}
} else {
// previous room was out of range (perhaps due to reconverting room system and the number of rooms decreasing)
p_previous_room_id = -1;
}
}
int num_bsp_rooms = 0;