make sure lights are unlinked, and clear light lists even when loading saves as saves may be from different levels

This commit is contained in:
Ricardo Luís Vaz Silva 2025-08-07 17:41:22 -03:00
commit 04c29dcf4b
2 changed files with 5 additions and 4 deletions

View file

@ -572,6 +572,9 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
bool wantFast;
unsigned int i;
primaryLevel->lightlists.wall_dlist.Clear();
primaryLevel->lightlists.flat_dlist.Clear();
// did we have any level before?
if (primaryLevel->info != nullptr)
staticEventManager.WorldUnloaded(FString()); // [MK] don't pass the new map, as it's not a level transition
@ -636,9 +639,6 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
primaryLevel->totaltime = 0;
primaryLevel->spawnindex = 0;
primaryLevel->lightlists.wall_dlist.Clear();
primaryLevel->lightlists.flat_dlist.Clear();
if (!multiplayer || !deathmatch)
{
InitPlayerClasses ();

View file

@ -646,6 +646,7 @@ void FDynamicLight::CollectWithinRadius(const DVector3 &opos, FSection *section,
void FDynamicLight::LinkLight()
{
UnlinkLight();
if (radius>0)
{
// passing in radius*radius allows us to do a distance check without any calls to sqrt
@ -664,7 +665,7 @@ void FDynamicLight::LinkLight()
// Deletes the link lists
//
//==========================================================================
void FDynamicLight::UnlinkLight ()
void FDynamicLight::UnlinkLight()
{
for(int i = 0; i < touchlists.wall_tlist.SSize(); i++)