Free land object SDL surfaces.
authornemo
Tue, 23 Mar 2010 19:06:43 +0000
changeset 3053 55a7e3a896ef
parent 3052 1d60306f6b34
child 3054 3b6b57d8b7cd
Free land object SDL surfaces.
hedgewars/hwengine.pas
hedgewars/uLandObjects.pas
--- a/hedgewars/hwengine.pas	Tue Mar 23 16:53:45 2010 +0000
+++ b/hedgewars/hwengine.pas	Tue Mar 23 19:06:43 2010 +0000
@@ -154,7 +154,8 @@
     if isSoundEnabled then ReleaseSound();
     StoreRelease();
     FreeGearsList();
-    FreeVisualGears;
+    FreeVisualGears();
+    FreeLandObjects();
     FreeLand();
     ControllerClose();
     SendKB();
--- a/hedgewars/uLandObjects.pas	Tue Mar 23 16:53:45 2010 +0000
+++ b/hedgewars/uLandObjects.pas	Tue Mar 23 19:06:43 2010 +0000
@@ -23,6 +23,7 @@
 uses SDLh;
 
 procedure AddObjects();
+procedure FreeLandObjects();
 procedure LoadThemeConfig;
 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
 procedure AddOnLandObjects(Surface: PSDL_Surface);
@@ -526,4 +527,15 @@
 ReadThemeInfo(ThemeObjects, SprayObjects)
 end;
 
+procedure FreeLandObjects();
+var i: Longword;
+begin
+for i:= 0 to Pred(ThemeObjects.Count) do
+    with ThemeObjects.objs[i] do
+        if Surf <> nil then SDL_FreeSurface(Surf);
+for i:= 0 to Pred(SprayObjects.Count) do
+    with SprayObjects.objs[i] do
+        if Surf <> nil then SDL_FreeSurface(Surf);
+end;
+
 end.