From 5dd0d8e550251e97b39d9c4253394b78f562f9cc Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Mon, 28 Nov 2022 19:06:40 +0200 Subject: [PATCH] "Match" CStateManager::BuildDynamicLightListForWorld --- src/MetroidPrime/CStateManager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/MetroidPrime/CStateManager.cpp b/src/MetroidPrime/CStateManager.cpp index d0be814c..0a3bd382 100644 --- a/src/MetroidPrime/CStateManager.cpp +++ b/src/MetroidPrime/CStateManager.cpp @@ -429,13 +429,14 @@ void CStateManager::BuildDynamicLightListForWorld() { } const CObjectList& list = GetObjectListById(kOL_GameLight); - if (list.size() == 0) { + int listSize = list.size(); + if (listSize == 0) { return; } - if (x8e0_dynamicLights.capacity() != list.size()) { + if (x8e0_dynamicLights.capacity() != listSize) { x8e0_dynamicLights = rstl::vector< CLight >(); - x8e0_dynamicLights.reserve(list.size()); + x8e0_dynamicLights.reserve(listSize); } else { x8e0_dynamicLights.clear(); } @@ -445,6 +446,7 @@ void CStateManager::BuildDynamicLightListForWorld() { if (light && light->GetActive()) { const CLight& l = light->GetLight(); if (l.GetIntensity() > FLT_EPSILON && l.GetRadius() > FLT_EPSILON) { + // TODO: This shouldn't be inlined, but currently is. x8e0_dynamicLights.push_back(l); } }