display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
authorsheepluva
Wed, 02 Sep 2015 01:25:29 +0200
changeset 11059 659427d9fd17
parent 11058 b91667fd6f20
child 11060 506b6184f4af
display circle for custom build dist values, display nothing if no limit. map borders are not taken into account at this point
hedgewars/uGearsRender.pas
--- a/hedgewars/uGearsRender.pas	Wed Sep 02 00:39:35 2015 +0200
+++ b/hedgewars/uGearsRender.pas	Wed Sep 02 01:25:29 2015 +0200
@@ -746,32 +746,39 @@
                 amRubber,
                 amGirder: begin
                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
-                    if WorldEdge = weWrap then
+                    if cBuildMaxDist = cDefaultBuildMaxDist then
                         begin
-                        if hwRound(Gear^.X) < LongInt(leftX) + 256 then
-                            DrawSpriteClipped(sprGirder,
-                                            rightX+(ox-leftX)-256,
-                                            oy-256,
-                                            LongInt(topY)+WorldDy,
-                                            LongInt(rightX)+WorldDx,
-                                            cWaterLine+WorldDy,
-                                            LongInt(leftX)+WorldDx);
-                        if hwRound(Gear^.X) > LongInt(rightX) - 256 then
-                            DrawSpriteClipped(sprGirder,
-                                            leftX-(rightX-ox)-256,
-                                            oy-256,
-                                            LongInt(topY)+WorldDy,
-                                            LongInt(rightX)+WorldDx,
-                                            cWaterLine+WorldDy,
-                                            LongInt(leftX)+WorldDx)
+                        if WorldEdge = weWrap then
+                            begin
+                            if hwRound(Gear^.X) < LongInt(leftX) + 256 then
+                                DrawSpriteClipped(sprGirder,
+                                                rightX+(ox-leftX)-256,
+                                                oy-256,
+                                                LongInt(topY)+WorldDy,
+                                                LongInt(rightX)+WorldDx,
+                                                cWaterLine+WorldDy,
+                                                LongInt(leftX)+WorldDx);
+                            if hwRound(Gear^.X) > LongInt(rightX) - 256 then
+                                DrawSpriteClipped(sprGirder,
+                                                leftX-(rightX-ox)-256,
+                                                oy-256,
+                                                LongInt(topY)+WorldDy,
+                                                LongInt(rightX)+WorldDx,
+                                                cWaterLine+WorldDy,
+                                                LongInt(leftX)+WorldDx)
+                            end;
+                        DrawSpriteClipped(sprGirder,
+                                        ox-256,
+                                        oy-256,
+                                        LongInt(topY)+WorldDy,
+                                        LongInt(rightX)+WorldDx,
+                                        cWaterLine+WorldDy,
+                                        LongInt(leftX)+WorldDx)
+                        end
+                    else if cBuildMaxDist > 0 then
+                        begin
+                            DrawCircle(hx, hy, cBuildMaxDist, 3, $FF, 0, 0, $80);
                         end;
-                    DrawSpriteClipped(sprGirder,
-                                    ox-256,
-                                    oy-256,
-                                    LongInt(topY)+WorldDy,
-                                    LongInt(rightX)+WorldDx,
-                                    cWaterLine+WorldDy,
-                                    LongInt(leftX)+WorldDx)
                     end;
                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);