🚨 Free the light collection when the light map update fails
This commit is contained in:
@@ -285,6 +285,7 @@ begin
|
|||||||
{Logger.Send([lcClient, lcDebug], 'AWidth', AWidth);
|
{Logger.Send([lcClient, lcDebug], 'AWidth', AWidth);
|
||||||
Logger.Send([lcClient, lcDebug], 'AHeight', AHeight);}
|
Logger.Send([lcClient, lcDebug], 'AHeight', AHeight);}
|
||||||
lights := TWorldItemList.Create(False);
|
lights := TWorldItemList.Create(False);
|
||||||
|
try
|
||||||
SetLength(tileMap, AWidth, AHeight);
|
SetLength(tileMap, AWidth, AHeight);
|
||||||
for x := 0 to AWidth - 1 do
|
for x := 0 to AWidth - 1 do
|
||||||
for y := 0 to AHeight - 1 do
|
for y := 0 to AHeight - 1 do
|
||||||
@@ -320,8 +321,9 @@ begin
|
|||||||
((tileMap[x,y] = nil) or (tileMap[x,y].Z < lights[i].Z + 5))) then
|
((tileMap[x,y] = nil) or (tileMap[x,y].Z < lights[i].Z + 5))) then
|
||||||
FLightSources.Add(TLightSource.Create(Self, lights[i]));
|
FLightSources.Add(TLightSource.Create(Self, lights[i]));
|
||||||
end;
|
end;
|
||||||
|
finally
|
||||||
lights.Free;
|
lights.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
FValid := False;
|
FValid := False;
|
||||||
//Logger.ExitMethod([lcClient, lcDebug], 'UpdateLightMap');
|
//Logger.ExitMethod([lcClient, lcDebug], 'UpdateLightMap');
|
||||||
|
|||||||
Reference in New Issue
Block a user