Inform frontend of lines which didn't change anything on the map in advanced drawn maps mode
--- a/hedgewars/uLandGraphics.pas Thu May 15 21:58:37 2014 +0400
+++ b/hedgewars/uLandGraphics.pas Mon May 19 22:46:02 2014 +0400
@@ -44,7 +44,7 @@
procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean);
function LandBackPixel(x, y: LongInt): LongWord;
procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
-function DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword): Longword;
+function DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword): Longword;
procedure DumpLandToLog(x, y, r: LongInt);
procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint);
function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline;
@@ -1001,6 +1001,8 @@
function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; inline;
begin
+ DrawDots:= 0;
+
if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x + xx] <> Color) then
begin inc(DrawDots); Land[y + yy, x + xx]:= Color; end;
if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x + xx] <> Color) then
--- a/hedgewars/uLandPainted.pas Thu May 15 21:58:37 2014 +0400
+++ b/hedgewars/uLandPainted.pas Mon May 19 22:46:02 2014 +0400
@@ -27,7 +27,7 @@
procedure freeModule;
implementation
-uses uLandGraphics, uConsts, uVariables, uUtils, SDLh, uCommands, uScript;
+uses uLandGraphics, uConsts, uVariables, uUtils, SDLh, uCommands, uScript, uIO;
type PointRec = packed record
X, Y: SmallInt;
@@ -82,12 +82,13 @@
prevPoint: PointRec;
radius: LongInt;
color: Longword;
- linePoints: Longword;
+ lineNumber, linePoints: Longword;
begin
// shutup compiler
prevPoint.X:= 0;
prevPoint.Y:= 0;
radius:= 0;
+ linePoints:= 0;
pe:= pointsListHead;
while (pe <> nil) and (pe^.point.flags and $80 = 0) do
@@ -96,16 +97,23 @@
pe:= pe^.next;
end;
+ lineNumber:= 0;
+
while(pe <> nil) do
begin
if (pe^.point.flags and $80 <> 0) then
begin
- if (pe^.point.flags and $40 <> 0) and (not cAdvancedMapGenMode) then
+ if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then
+ SendIPC('|' + inttostr(lineNumber - 1));
+
+ inc(lineNumber);
+
+ if (pe^.point.flags and $40 <> 0) then
color:= 0
else
color:= lfBasic;
radius:= (pe^.point.flags and $3F) * 5 + 3;
- linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color)
+ linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color);
end
else
begin