# HG changeset patch # User jose1711 # Date 1293132765 -3600 # Node ID ed23eba1a36961172ef6088f8265e7cba839961d # Parent 20b982afbe6efb6e72bcc44ae7a838ce050773ae# Parent 0167cbb6aee35bbef6a858fa620dfacdb8bf9af8 merge diff -r 20b982afbe6e -r ed23eba1a369 hedgewars/uCommands.pas --- 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 diff -r 20b982afbe6e -r ed23eba1a369 hedgewars/uLandPainted.pas --- 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;