hedgewars/uVisualGearsList.pas
changeset 9769 5814e0c47c99
parent 9287 bb9ad6a5f625
child 9960 fac73b8a52d3
child 9998 736015b847e3
--- a/hedgewars/uVisualGearsList.pas	Sun Dec 08 16:04:40 2013 -0500
+++ b/hedgewars/uVisualGearsList.pas	Mon Dec 09 10:59:38 2013 -0500
@@ -24,7 +24,8 @@
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
 procedure DeleteVisualGear(Gear: PVisualGear);
 function  VisualGearByUID(uid : Longword) : PVisualGear;
 
@@ -39,15 +40,20 @@
 
 function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
 begin
-    AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false);
+    AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1);
 end;
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
 begin
-    AddVisualGear:= AddVisualGear(X, Y, Kind, State, false);
+    AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1);
 end;
 
-function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
+begin
+    AddVisualGear:= AddVisualGear(X, Y, Kind, State, Critical, -1);
+end;
+
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
 var gear: PVisualGear;
     t: Longword;
     sp: real;
@@ -401,6 +407,8 @@
     vgtCircle: gear^.Layer:= 2
 end;
 
+if Layer <> -1 then gear^.Layer:= Layer;
+
 if VisualGearLayers[gear^.Layer] <> nil then
     begin
     VisualGearLayers[gear^.Layer]^.PrevGear:= gear;