From bd175f1c5349d0734e9ec7394e9ee79dbc870e02 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 16 Jul 2022 17:28:00 +0200 Subject: [PATCH] Reduce double scans in GetSizeForThemeRoom This takes it from 200% to just 110% tiles scanned during the processes --- Source/levels/gendung.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/levels/gendung.cpp b/Source/levels/gendung.cpp index e5fe3322f..4946ea30a 100644 --- a/Source/levels/gendung.cpp +++ b/Source/levels/gendung.cpp @@ -105,7 +105,7 @@ std::optional GetSizeForThemeRoom(int floor, Point origin, int minSize, in Size room { maxWidth, maxHeight }; for (int i = 0; i < maxSize; i++) { - int width = 0; + int width = i < room.height ? i : 0; if (i < maxHeight) { while (width < room.width) { if (dungeon[origin.x + width][origin.y + i] != floor) @@ -115,7 +115,7 @@ std::optional GetSizeForThemeRoom(int floor, Point origin, int minSize, in } } - int height = 0; + int height = i < room.width ? i : 0; if (i < maxWidth) { while (height < room.height) { if (dungeon[origin.x + i][origin.y + height] != floor)