hedgewars/uLandGraphics.pas
changeset 4886 e3e5362a308e
parent 4791 458d9854c679
child 4976 088d40d8aba2
--- a/hedgewars/uLandGraphics.pas	Sun Jan 30 06:56:12 2011 +0100
+++ b/hedgewars/uLandGraphics.pas	Sun Jan 30 19:05:31 2011 +0100
@@ -38,7 +38,7 @@
 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
 function  LandBackPixel(x, y: LongInt): LongWord;
 
-function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
+function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 
 implementation
 uses SDLh, uLandTexture, uVariables, uUtils, uDebug;
@@ -619,7 +619,7 @@
 UpdateLandTexture(tx, ddx, ty, ddy)
 end;
 
-function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
+function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt;
     p: PByteArray;
     Image: PSDL_Surface;
@@ -675,7 +675,10 @@
             for x:= 0 to Pred(w) do
                 if PLongword(@(p^[x * 4]))^ <> 0 then
                    begin
-                   Land[cpY + y, cpX + x]:= lfObject;
+                   if indestructible then
+                       Land[cpY + y, cpX + x]:= lfIndestructible
+                   else
+                       Land[cpY + y, cpX + x]:= lfObject;
                    if (cReducedQuality and rqBlurryLand) = 0 then
                        LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^
                    else