hedgewars/uLand.pas
changeset 6303 3edb3c857995
parent 6254 e90fb60cb46d
child 6313 12567f6f6f02
equal deleted inserted replaced
6302:db8bdbb34e03 6303:3edb3c857995
    34 procedure GenMap;
    34 procedure GenMap;
    35 function  GenPreview: TPreview;
    35 function  GenPreview: TPreview;
    36 
    36 
    37 implementation
    37 implementation
    38 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils,
    38 uses uConsole, uStore, uRandom, uLandObjects, uIO, uLandTexture, sysutils,
    39      uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted;
    39      uVariables, uUtils, uCommands, Adler32, uDebug, uLandPainted, uTextures;
    40 
    40 
    41 operator=(const a, b: direction) c: Boolean;
    41 operator=(const a, b: direction) c: Boolean;
    42 begin
    42 begin
    43     c := (a.x = b.x) and (a.y = b.y);
    43     c := (a.x = b.x) and (a.y = b.y);
    44 end;
    44 end;
   300     SDL_FreeSurface(tmpsurf);
   300     SDL_FreeSurface(tmpsurf);
   301 
   301 
   302     // freed in freeModule() below
   302     // freed in freeModule() below
   303     LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
   303     LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
   304     if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
   304     if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
       
   305     if (LandBackSurface <> nil) and cGrayScale then Surface2GrayScale(LandBackSurface);
   305 
   306 
   306     tmpsurf:= LoadImage(UserPathz[ptCurrTheme] + '/Border', ifIgnoreCaps or ifTransparent);
   307     tmpsurf:= LoadImage(UserPathz[ptCurrTheme] + '/Border', ifIgnoreCaps or ifTransparent);
   307     if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent);
   308     if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent);
   308     for x:= 0 to LAND_WIDTH - 1 do
   309     for x:= 0 to LAND_WIDTH - 1 do
   309     begin
   310     begin
  1178         SDL_UnlockSurface(tmpsurf);
  1179         SDL_UnlockSurface(tmpsurf);
  1179     if not disableLandBack then
  1180     if not disableLandBack then
  1180         begin
  1181         begin
  1181         // freed in freeModule() below
  1182         // freed in freeModule() below
  1182         LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
  1183         LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
  1183         if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent)
  1184         if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
       
  1185         if (LandBackSurface <> nil) and cGrayScale then Surface2GrayScale(LandBackSurface)
  1184         end;
  1186         end;
  1185 end;
  1187 end;
  1186 if (tmpsurf <> nil) then
  1188 if (tmpsurf <> nil) then
  1187     SDL_FreeSurface(tmpsurf);
  1189     SDL_FreeSurface(tmpsurf);
  1188 tmpsurf:= nil;
  1190 tmpsurf:= nil;