- 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 = Spawn<ADynamicLight>(actor->Pos(), NO_REPLACE);
light->target = actor; light->target = actor;
light->owned = true; light->owned = true;
light->ObjectFlags |= OF_Transient;
actor->dynamiclights.Push(light); actor->dynamiclights.Push(light);
} }
light->flags2&=~MF2_DORMANT; light->flags2&=~MF2_DORMANT;

View file

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