From 9ee325e537ee6268bd6c4ec9e6c465f2f71fbeee Mon Sep 17 00:00:00 2001 From: obligaron Date: Sun, 2 Oct 2022 20:18:31 +0200 Subject: [PATCH] TFit_Obj5: Fix theme room generation when only last skipped candidate was valid --- Source/levels/themes.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/levels/themes.cpp b/Source/levels/themes.cpp index 7d6c4bdc8..806388311 100644 --- a/Source/levels/themes.cpp +++ b/Source/levels/themes.cpp @@ -109,20 +109,20 @@ bool TFit_Obj5(int t) return true; } + bool validFound = false; for (int yp = 0; yp < MAXDUNY; yp++) { for (int xp = 0; xp < MAXDUNX; xp++) { if (dTransVal[xp][yp] == themes[t].ttval && IsTileNotSolid({ xp, yp }) && CheckThemeObj5({ xp, yp }, themes[t].ttval)) { - if (skipCandidates > 0) { - skipCandidates--; - continue; - } themex = xp; themey = yp; - return true; + validFound = true; + skipCandidates--; + if (skipCandidates <= 0) + return true; } } } - return false; + return validFound; } bool TFit_SkelRoom(int t) {