- use the newly added OF_Transient flag to avoid writing out the owned dynamic lights to savegames instead of destroying and recreating them each time.

This commit is contained in:
Christoph Oelckers 2016-10-16 09:12:43 +02:00
parent b03489a43c
commit 59576e6d23
2 changed files with 6 additions and 3 deletions

View file

@ -1081,6 +1081,7 @@ void gl_AttachLight(AActor *actor, unsigned int count, const FLightDefaults *lig
light = Spawn<ADynamicLight>(actor->Pos(), NO_REPLACE);
light->target = actor;
light->owned = true;
light->ObjectFlags |= OF_Transient;
actor->dynamiclights.Push(light);
}
light->flags2&=~MF2_DORMANT;

View file

@ -1199,7 +1199,6 @@ void FGLInterface::StateChanged(AActor *actor)
void FGLInterface::StartSerialize(FSerializer &arc)
{
gl_DeleteAllAttachedLights();
if (arc.BeginObject("glinfo"))
{
arc("fogdensity", fogdensity)
@ -1211,8 +1210,11 @@ void FGLInterface::StartSerialize(FSerializer &arc)
void FGLInterface::EndSerialize(FSerializer &arc)
{
gl_RecreateAllAttachedLights();
if (arc.isReading()) gl_InitPortals();
if (arc.isReading())
{
gl_RecreateAllAttachedLights();
gl_InitPortals();
}
}
//===========================================================================