"Match" CStateManager::BuildDynamicLightListForWorld

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-28 19:06:40 +02:00
parent 0c29161e11
commit 5dd0d8e550
No known key found for this signature in database
GPG Key ID: E224F951761145F8
1 changed files with 5 additions and 3 deletions

View File

@ -429,13 +429,14 @@ void CStateManager::BuildDynamicLightListForWorld() {
} }
const CObjectList& list = GetObjectListById(kOL_GameLight); const CObjectList& list = GetObjectListById(kOL_GameLight);
if (list.size() == 0) { int listSize = list.size();
if (listSize == 0) {
return; return;
} }
if (x8e0_dynamicLights.capacity() != list.size()) { if (x8e0_dynamicLights.capacity() != listSize) {
x8e0_dynamicLights = rstl::vector< CLight >(); x8e0_dynamicLights = rstl::vector< CLight >();
x8e0_dynamicLights.reserve(list.size()); x8e0_dynamicLights.reserve(listSize);
} else { } else {
x8e0_dynamicLights.clear(); x8e0_dynamicLights.clear();
} }
@ -445,6 +446,7 @@ void CStateManager::BuildDynamicLightListForWorld() {
if (light && light->GetActive()) { if (light && light->GetActive()) {
const CLight& l = light->GetLight(); const CLight& l = light->GetLight();
if (l.GetIntensity() > FLT_EPSILON && l.GetRadius() > FLT_EPSILON) { if (l.GetIntensity() > FLT_EPSILON && l.GetRadius() > FLT_EPSILON) {
// TODO: This shouldn't be inlined, but currently is.
x8e0_dynamicLights.push_back(l); x8e0_dynamicLights.push_back(l);
} }
} }