From fe75116d5ba9f448d90d403e86a1751b5346c56f Mon Sep 17 00:00:00 2001 From: XProger Date: Sat, 12 Feb 2022 12:08:46 +0300 Subject: [PATCH] #368 check floorIndex before heavy getTriggerFloorCeiling call --- src/fixed/room.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fixed/room.h b/src/fixed/room.h index c8c25f3..f48b788 100644 --- a/src/fixed/room.h +++ b/src/fixed/room.h @@ -49,9 +49,9 @@ int32 Sector::getFloor(int32 x, int32 y, int32 z) const floor -= sx * (sx < 0 ? dx : (dx - 1023)) >> 2; floor -= sz * (sz < 0 ? dz : (dz - 1023)) >> 2; } - } - lowerSector->getTriggerFloorCeiling(x, y, z, &floor, NULL); + lowerSector->getTriggerFloorCeiling(x, y, z, &floor, NULL); + } return floor; } @@ -86,7 +86,10 @@ int32 Sector::getCeiling(int32 x, int32 y, int32 z) const const Sector* lowerSector = getSectorBelow(x, z); - lowerSector->getTriggerFloorCeiling(x, y, z, NULL, &ceiling); + if (lowerSector->floorIndex) + { + lowerSector->getTriggerFloorCeiling(x, y, z, NULL, &ceiling); + } return ceiling; }