Fixes for dynamic lights

Fixed released lights not unlinking in rare cases. Fixed first Actor in cache being missed when destruction checking. Fixed results cache not being cleared on update.
This commit is contained in:
Boondorl 2025-01-21 14:43:59 -05:00 committed by Magnus Norddahl
commit b68c7545cd

View file

@ -305,6 +305,7 @@ void FDynamicLight::Tick()
if (!target)
{
// How did we get here? :?
UnlinkLight();
ReleaseLight();
return;
}
@ -444,16 +445,18 @@ void FDynamicLight::Tick()
if(updated)
{
ActorList.Clear();
ActorResult.Clear();
}
else if(ActorList.Size() > 0)
{
unsigned i = ActorList.Size() - 1;
unsigned i = ActorList.Size();
while(i > 0)
{
if(ActorList[i]->ObjectFlags & OF_EuthanizeMe)
const unsigned index = i - 1u;
if(ActorList[index]->ObjectFlags & OF_EuthanizeMe)
{
ActorList.Delete(i);
ActorResult.Delete(i);
ActorList.Delete(index);
ActorResult.Delete(index);
}
i--;
}