Fixed infinite loop if bridges with zero thickness exist in level

This commit is contained in:
Lwmte 2024-12-17 01:39:11 +01:00
parent dad63f98c5
commit 88bbe48621
2 changed files with 8 additions and 2 deletions

View file

@ -72,7 +72,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed incorrect behaviour of Logic.EnableEvent() and Logic.DisableEvent() functions.
* Fixed Util.HasLineOfSight() not taking static meshes into consideration.
* Fixed collision callbacks not properly clearing after leveljump.
* Fixed Flow.SetIntroImagePath() not using the correct path
* Fixed Flow.SetIntroImagePath() not using the correct path.
## [Version 1.5](https://github.com/TombEngine/TombEditorReleases/releases/tag/v1.7.2) - 2024-11-03

View file

@ -543,8 +543,14 @@ namespace TEN::Collision::Floordata
auto* sector = &currentSector;
do
{
// For bridges with zero thickness (which is incorrect setup, but still possible), break out of
// infinite loop caused by infinite traversal over the same height value.
int nextPos = sector->GetBridgeSurfaceHeight(pos, !isBottom);
if (nextPos = pos.y)
nextPos += (isBottom ? 1 : -1);
// Set vertical position to lowest bridge ceiling height or highest bridge floor height.
pos.y = sector->GetBridgeSurfaceHeight(pos, !isBottom);
pos.y = nextPos;
// Find sector at lowest bridge floor height or highest bridge ceiling height.
while (isBottom ?