Fixes compilation of the chess game

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1335 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2010-10-05 20:05:41 +00:00
parent 7787d207ee
commit e200bb3faf
5 changed files with 151 additions and 114 deletions

View File

@ -24,6 +24,19 @@ const
type type
TPacketKind = (pkConnect, pkStartGameClientAsWhite, pkStartGameClientAsBlack, pkMove);
{ TPacket }
TPacket = class
public
// Packet Data
ID: Cardinal;
Kind: TPacketKind;
MoveStartX, MoveStartY, MoveEndX, MoveEndY: Byte;
Next: TPacket; // To build a linked list
end;
TChessTile = (ctEmpty, TChessTile = (ctEmpty,
ctWPawn, ctWKnight, ctWBishop, ctWRook, ctWQueen, ctWKing, ctWPawn, ctWKnight, ctWBishop, ctWRook, ctWQueen, ctWKing,
ctBPawn, ctBKnight, ctBBishop, ctBRook, ctBQueen, ctBKing ctBPawn, ctBKnight, ctBBishop, ctBRook, ctBQueen, ctBKing

View File

@ -26,17 +26,25 @@
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="1"> <RequiredPackages Count="2">
<Item1> <Item1>
<PackageName Value="LCL"/> <PackageName Value="lnetvisual"/>
</Item1> </Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="31"> <Units Count="32">
<Unit0> <Unit0>
<Filename Value="fpchess.lpr"/> <Filename Value="fpchess.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fpchess"/> <UnitName Value="fpchess"/>
<UsageCount Value="38"/> <EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="77" Y="10"/>
<UsageCount Value="39"/>
<Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
@ -44,12 +52,11 @@
<ComponentName Value="formChess"/> <ComponentName Value="formChess"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="mainform"/> <UnitName Value="mainform"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="92"/> <TopLine Value="92"/>
<CursorPos X="61" Y="104"/> <CursorPos X="1" Y="100"/>
<UsageCount Value="38"/> <UsageCount Value="39"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@ -124,12 +131,10 @@
<Unit11> <Unit11>
<Filename Value="..\..\..\lazarussvn\lcl\controls.pp"/> <Filename Value="..\..\..\lazarussvn\lcl\controls.pp"/>
<UnitName Value="Controls"/> <UnitName Value="Controls"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="305"/> <TopLine Value="305"/>
<CursorPos X="61" Y="320"/> <CursorPos X="61" Y="320"/>
<UsageCount Value="19"/> <UsageCount Value="19"/>
<Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="..\..\..\lazarussvn\lcl\include\notebook.inc"/> <Filename Value="..\..\..\lazarussvn\lcl\include\notebook.inc"/>
@ -164,11 +169,11 @@
<Filename Value="chessdrawer.pas"/> <Filename Value="chessdrawer.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="chessdrawer"/> <UnitName Value="chessdrawer"/>
<EditorIndex Value="3"/> <EditorIndex Value="5"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="3" Y="25"/> <CursorPos X="3" Y="25"/>
<UsageCount Value="36"/> <UsageCount Value="37"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
@ -222,22 +227,22 @@
<Filename Value="chessgame.pas"/> <Filename Value="chessgame.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="chessgame"/> <UnitName Value="chessgame"/>
<EditorIndex Value="1"/> <EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="22"/>
<CursorPos X="40" Y="8"/> <CursorPos X="1" Y="28"/>
<UsageCount Value="28"/> <UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="chessconfig.pas"/> <Filename Value="chessconfig.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="chessconfig"/> <UnitName Value="chessconfig"/>
<EditorIndex Value="2"/> <EditorIndex Value="3"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="18"/> <TopLine Value="1"/>
<CursorPos X="13" Y="39"/> <CursorPos X="14" Y="10"/>
<UsageCount Value="28"/> <UsageCount Value="29"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
@ -287,127 +292,139 @@
<CursorPos X="1" Y="30"/> <CursorPos X="1" Y="30"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit30> </Unit30>
<Unit31>
<Filename Value="tcpcomm.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="tcpcomm"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="523"/>
<CursorPos X="1" Y="545"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit31>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="112" Column="1" TopLine="103"/> <Caret Line="270" Column="20" TopLine="259"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="122" Column="1" TopLine="103"/> <Caret Line="261" Column="23" TopLine="248"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="123" Column="1" TopLine="103"/> <Caret Line="138" Column="1" TopLine="124"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="121" Column="43" TopLine="104"/> <Caret Line="94" Column="39" TopLine="81"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="123" Column="1" TopLine="104"/> <Caret Line="99" Column="45" TopLine="81"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="157" Column="15" TopLine="143"/> <Caret Line="110" Column="1" TopLine="108"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="56" Column="29" TopLine="33"/> <Caret Line="92" Column="17" TopLine="81"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="85" Column="1" TopLine="82"/> <Caret Line="144" Column="44" TopLine="131"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="87" Column="57" TopLine="72"/> <Caret Line="151" Column="1" TopLine="138"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="56" Column="29" TopLine="47"/> <Caret Line="39" Column="15" TopLine="21"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="79" Column="36" TopLine="79"/> <Caret Line="36" Column="32" TopLine="16"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="111" Column="3" TopLine="97"/> <Caret Line="145" Column="44" TopLine="132"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="122" Column="26" TopLine="108"/> <Caret Line="24" Column="74" TopLine="17"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="123" Column="26" TopLine="109"/> <Caret Line="61" Column="25" TopLine="45"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="124" Column="26" TopLine="110"/> <Caret Line="48" Column="1" TopLine="35"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="122" Column="29" TopLine="111"/> <Caret Line="178" Column="3" TopLine="165"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="77" Column="24" TopLine="72"/> <Caret Line="258" Column="42" TopLine="245"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="53" Column="16" TopLine="41"/> <Caret Line="262" Column="8" TopLine="245"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="125" Column="49" TopLine="125"/> <Caret Line="257" Column="1" TopLine="237"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="54" Column="15" TopLine="53"/> <Caret Line="273" Column="10" TopLine="256"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="77" Column="24" TopLine="72"/> <Caret Line="665" Column="3" TopLine="649"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="78" Column="22" TopLine="73"/> <Caret Line="291" Column="8" TopLine="273"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="56" Column="24" TopLine="42"/> <Caret Line="303" Column="26" TopLine="290"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="63" Column="14" TopLine="43"/> <Caret Line="382" Column="44" TopLine="367"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="78" Column="22" TopLine="73"/> <Caret Line="410" Column="1" TopLine="393"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="80" Column="22" TopLine="75"/> <Caret Line="369" Column="32" TopLine="356"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="175" Column="3" TopLine="32"/> <Caret Line="435" Column="3" TopLine="424"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="172" Column="14" TopLine="158"/> <Caret Line="47" Column="1" TopLine="30"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="chessgame.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="178" Column="14" TopLine="163"/> <Caret Line="486" Column="22" TopLine="473"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="mainform.pas"/> <Filename Value="tcpcomm.pas"/>
<Caret Line="107" Column="60" TopLine="90"/> <Caret Line="543" Column="32" TopLine="519"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -7,8 +7,7 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, mainform, chessdrawer, chessgame, chessconfig Forms, lnetvisual, mainform, chessdrawer, chessgame, chessconfig, tcpcomm;
{ you can add units after this };
{$R *.res} {$R *.res}

View File

@ -13,11 +13,12 @@ object formChess: TformChess
Height = 433 Height = 433
Top = 0 Top = 0
Width = 360 Width = 360
PageIndex = 0 PageIndex = 1
Align = alClient Align = alClient
TabOrder = 0 TabOrder = 0
TabStop = True TabStop = True
object pageStart: TUNBPage object pageStart: TUNBPage
OnBeforeShow = pageStartBeforeShow
ClientWidth = 360 ClientWidth = 360
ClientHeight = 433 ClientHeight = 433
object Label1: TLabel object Label1: TLabel
@ -71,7 +72,7 @@ object formChess: TformChess
end end
object editPlayerName: TLabeledEdit object editPlayerName: TLabeledEdit
Left = 88 Left = 88
Height = 21 Height = 22
Top = 72 Top = 72
Width = 120 Width = 120
EditLabel.AnchorSideLeft.Control = editPlayerName EditLabel.AnchorSideLeft.Control = editPlayerName
@ -79,10 +80,10 @@ object formChess: TformChess
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = editPlayerName EditLabel.AnchorSideRight.Control = editPlayerName
EditLabel.AnchorSideBottom.Control = editPlayerName EditLabel.AnchorSideBottom.Control = editPlayerName
EditLabel.Left = 24 EditLabel.Left = 6
EditLabel.Height = 14 EditLabel.Height = 17
EditLabel.Top = 75 EditLabel.Top = 75
EditLabel.Width = 61 EditLabel.Width = 79
EditLabel.Caption = 'Player Name' EditLabel.Caption = 'Player Name'
EditLabel.ParentColor = False EditLabel.ParentColor = False
LabelPosition = lpLeft LabelPosition = lpLeft
@ -90,9 +91,9 @@ object formChess: TformChess
end end
object Label6: TLabel object Label6: TLabel
Left = 28 Left = 28
Height = 14 Height = 17
Top = 104 Top = 104
Width = 43 Width = 52
Caption = 'Start as:' Caption = 'Start as:'
ParentColor = False ParentColor = False
end end
@ -101,7 +102,7 @@ object formChess: TformChess
Height = 21 Height = 21
Top = 104 Top = 104
Width = 120 Width = 120
ItemHeight = 13 ItemHeight = 0
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'White' 'White'
@ -112,9 +113,9 @@ object formChess: TformChess
end end
object checkTimer: TCheckBox object checkTimer: TCheckBox
Left = 24 Left = 24
Height = 17 Height = 18
Top = 136 Top = 136
Width = 163 Width = 212
Caption = 'Set a time limit for each Player' Caption = 'Set a time limit for each Player'
Checked = True Checked = True
State = cbChecked State = cbChecked
@ -122,7 +123,7 @@ object formChess: TformChess
end end
object spinPlayerTime: TSpinEdit object spinPlayerTime: TSpinEdit
Left = 21 Left = 21
Height = 21 Height = 16
Top = 160 Top = 160
Width = 50 Width = 50
TabOrder = 6 TabOrder = 6
@ -130,9 +131,9 @@ object formChess: TformChess
end end
object Label7: TLabel object Label7: TLabel
Left = 80 Left = 80
Height = 14 Height = 17
Top = 163 Top = 163
Width = 114 Width = 150
Caption = 'minutes for each player' Caption = 'minutes for each player'
ParentColor = False ParentColor = False
end end
@ -147,8 +148,8 @@ object formChess: TformChess
end end
end end
object pageConfigConnection: TUNBPage object pageConfigConnection: TUNBPage
ClientWidth = 960 ClientWidth = 360
ClientHeight = 1200 ClientHeight = 433
object Label3: TLabel object Label3: TLabel
Left = 0 Left = 0
Height = 32 Height = 32
@ -161,16 +162,16 @@ object formChess: TformChess
ParentColor = False ParentColor = False
ParentFont = False ParentFont = False
end end
object LabeledEdit1: TLabeledEdit object editRemoteID: TLabeledEdit
Left = 112 Left = 112
Height = 22 Height = 22
Top = 72 Top = 72
Width = 120 Width = 120
EditLabel.AnchorSideLeft.Control = LabeledEdit1 EditLabel.AnchorSideLeft.Control = editRemoteID
EditLabel.AnchorSideTop.Control = LabeledEdit1 EditLabel.AnchorSideTop.Control = editRemoteID
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEdit1 EditLabel.AnchorSideRight.Control = editRemoteID
EditLabel.AnchorSideBottom.Control = LabeledEdit1 EditLabel.AnchorSideBottom.Control = editRemoteID
EditLabel.Left = 8 EditLabel.Left = 8
EditLabel.Height = 17 EditLabel.Height = 17
EditLabel.Top = 75 EditLabel.Top = 75
@ -179,18 +180,17 @@ object formChess: TformChess
EditLabel.ParentColor = False EditLabel.ParentColor = False
LabelPosition = lpLeft LabelPosition = lpLeft
TabOrder = 0 TabOrder = 0
Text = 'LabeledEdit1'
end end
object LabeledEdit2: TLabeledEdit object editLocalIP: TLabeledEdit
Left = 112 Left = 112
Height = 22 Height = 22
Top = 104 Top = 104
Width = 120 Width = 120
EditLabel.AnchorSideLeft.Control = LabeledEdit2 EditLabel.AnchorSideLeft.Control = editLocalIP
EditLabel.AnchorSideTop.Control = LabeledEdit2 EditLabel.AnchorSideTop.Control = editLocalIP
EditLabel.AnchorSideTop.Side = asrCenter EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEdit2 EditLabel.AnchorSideRight.Control = editLocalIP
EditLabel.AnchorSideBottom.Control = LabeledEdit2 EditLabel.AnchorSideBottom.Control = editLocalIP
EditLabel.Left = 4 EditLabel.Left = 4
EditLabel.Height = 17 EditLabel.Height = 17
EditLabel.Top = 107 EditLabel.Top = 107
@ -200,7 +200,6 @@ object formChess: TformChess
LabelPosition = lpLeft LabelPosition = lpLeft
ReadOnly = True ReadOnly = True
TabOrder = 1 TabOrder = 1
Text = 'LabeledEdit2'
end end
object BitBtn1: TBitBtn object BitBtn1: TBitBtn
Left = 8 Left = 8
@ -212,8 +211,8 @@ object formChess: TformChess
end end
end end
object pageConnecting: TUNBPage object pageConnecting: TUNBPage
ClientWidth = 960 ClientWidth = 1920
ClientHeight = 1200 ClientHeight = 2400
object Label4: TLabel object Label4: TLabel
Left = 0 Left = 0
Height = 32 Height = 32
@ -235,8 +234,8 @@ object formChess: TformChess
end end
end end
object pageGame: TUNBPage object pageGame: TUNBPage
ClientWidth = 480 ClientWidth = 960
ClientHeight = 866 ClientHeight = 1732
object Label5: TLabel object Label5: TLabel
Left = 0 Left = 0
Height = 32 Height = 32

View File

@ -41,8 +41,8 @@ type
Label6: TLabel; Label6: TLabel;
Label7: TLabel; Label7: TLabel;
labelPos: TLabel; labelPos: TLabel;
LabeledEdit1: TLabeledEdit; editRemoteID: TLabeledEdit;
LabeledEdit2: TLabeledEdit; editLocalIP: TLabeledEdit;
editPlayerName: TLabeledEdit; editPlayerName: TLabeledEdit;
pageStart: TUNBPage; pageStart: TUNBPage;
pageConfigConnection: TUNBPage; pageConfigConnection: TUNBPage;
@ -54,6 +54,7 @@ type
timerChessTimer: TTimer; timerChessTimer: TTimer;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure HandleMainScreenButton(Sender: TObject); procedure HandleMainScreenButton(Sender: TObject);
procedure pageStartBeforeShow(Sender: TObject);
procedure timerChessTimerTimer(Sender: TObject); procedure timerChessTimerTimer(Sender: TObject);
private private
{ private declarations } { private declarations }
@ -87,6 +88,14 @@ begin
else if Sender = btnDirectComm then notebookMain.PageIndex := 1; else if Sender = btnDirectComm then notebookMain.PageIndex := 1;
end; end;
procedure TformChess.pageStartBeforeShow(Sender: TObject);
begin
if notebookMain.PageIndex = 1 then
begin
editLocalIP.Text := '';
end;
end;
procedure TformChess.timerChessTimerTimer(Sender: TObject); procedure TformChess.timerChessTimerTimer(Sender: TObject);
begin begin
vChessGame.UpdateTimes(); vChessGame.UpdateTimes();