--- a/hedgewars/uCommands.pas Thu Dec 23 20:26:31 2010 +0100
+++ b/hedgewars/uCommands.pas Thu Dec 23 20:32:45 2010 +0100
@@ -60,7 +60,7 @@
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
s:= '';
SplitBySpace(CmdStr, s);
-{$IFDEF DEBUGFILE}AddFileLog('[Cmd] ' + c + CmdStr + ' (' + inttostr(length(CmdStr)) + ')');{$ENDIF}
+{$IFDEF DEBUGFILE}AddFileLog('[Cmd] ' + c + CmdStr + ' (' + inttostr(length(s)) + ')');{$ENDIF}
t:= Variables;
while t <> nil do
begin
--- a/hedgewars/uLandPainted.pas Thu Dec 23 20:26:31 2010 +0100
+++ b/hedgewars/uLandPainted.pas Thu Dec 23 20:32:45 2010 +0100
@@ -22,12 +22,11 @@
interface
-procedure LoadFromFile(fileName: shortstring);
procedure Draw;
procedure initModule;
implementation
-uses uLandGraphics, uConsts, uUtils, SDLh, uCommands;
+uses uLandGraphics, uConsts, uUtils, SDLh, uCommands, uDebug;
type PointRec = packed record
X, Y: SmallInt;
@@ -106,34 +105,6 @@
end
end;
-
-procedure LoadFromFile(fileName: shortstring);
-var
- f: file of PointRec;
- rec, prevRec: PointRec;
-begin
- fileMode:= 0;
-
- assignFile(f, fileName);
- reset(f);
-
- while not eof(f) do
- begin
- read(f, rec);
- rec.X:= SDLNet_Read16(@rec.X);
- rec.Y:= SDLNet_Read16(@rec.Y);
-
- // FIXME: handle single point
- if eof(f) or (rec.flags and $80 <> 0) then
- else
- DrawLineOnLand(prevRec.X, prevRec.Y, rec.X, rec.Y);
-
- prevRec:= rec;
- end;
-
- closeFile(f);
-end;
-
procedure chDraw(var s: shortstring);
var rec: PointRec;
prec: ^PointRec;
@@ -167,17 +138,28 @@
var pe: PPointEntry;
prevPoint: PointRec;
begin
+ // shutup compiler
+ prevPoint.X:= 0;
+ prevPoint.Y:= 0;
+
pe:= pointsListHead;
+ TryDo((pe = nil) or (pe^.point.flags and $80 <> 0), 'Corrupted draw data', true);
while(pe <> nil) do
begin
if (pe^.point.flags and $80 <> 0) then
+ begin
+ AddFileLog('[DRAW] Move to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
FillRoundInLand(pe^.point.X, pe^.point.Y, 34, lfBasic)
+ end
else
+ begin
+ AddFileLog('[DRAW] Line to: ('+inttostr(pe^.point.X)+','+inttostr(pe^.point.Y)+')');
DrawLineOnLand(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y);
+ end;
prevPoint:= pe^.point;
- pe:= pe^.next;
+ pe:= pe^.next;
end;
end;