From bc8135e8963eb5bac2d82cb47bf7304b6fe26da0 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 16 Sep 2020 13:01:06 -0400 Subject: [PATCH] CBooRenderer: Fix light count in ActivateLightsForModel --- Runtime/Graphics/CBooRenderer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Runtime/Graphics/CBooRenderer.cpp b/Runtime/Graphics/CBooRenderer.cpp index 990c503f5..58811941b 100644 --- a/Runtime/Graphics/CBooRenderer.cpp +++ b/Runtime/Graphics/CBooRenderer.cpp @@ -226,10 +226,10 @@ void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model) std::vector thisLights; thisLights.reserve(4); - if (x300_dynamicLights.size()) { + if (!x300_dynamicLights.empty()) { u32 lightOctreeWordCount = 0; const u32* lightOctreeWords = nullptr; - if (item && model.x44_areaInstanceIdx != UINT32_MAX) { + if (item != nullptr && model.x44_areaInstanceIdx != UINT32_MAX) { lightOctreeWordCount = item->x4_octTree->x14_bitmapWordCount; lightOctreeWords = item->x1c_lightOctreeWords.data(); } @@ -237,10 +237,10 @@ void CBooRenderer::ActivateLightsForModel(CAreaListItem* item, CBooModel& model) std::array lightRads{-1.f, -1.f, -1.f, -1.f}; std::array lightRefs{}; auto it = x300_dynamicLights.begin(); - for (size_t i = 0; i < thisLights.size() && it != x300_dynamicLights.end(); + for (size_t i = 0; i < thisLights.capacity() && it != x300_dynamicLights.end(); ++it, lightOctreeWords += lightOctreeWordCount) { CLight& refLight = *it; - if (lightOctreeWords && !TestBit(lightOctreeWords, model.x44_areaInstanceIdx)) { + if (lightOctreeWords != nullptr && !TestBit(lightOctreeWords, model.x44_areaInstanceIdx)) { continue; }