You've already forked lazarus-ccr
Adds the capability to get the local IP to the chess game
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1336 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
66
applications/fpchess/chesstcputils.pas
Normal file
66
applications/fpchess/chesstcputils.pas
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
unit chesstcputils;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
Winsock,
|
||||||
|
{$ENDIF}
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
function ChessGetLocalIP(): string;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
const
|
||||||
|
CFormatIPMask = '%d.%d.%d.%d';
|
||||||
|
|
||||||
|
function ChessGetLocalIP(): string;
|
||||||
|
var
|
||||||
|
I, VAttempt: Integer;
|
||||||
|
VStrTemp, VSitesToTry: TStringList;
|
||||||
|
{$IFDEF UNIX}
|
||||||
|
VProcess: TProcess;
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
var
|
||||||
|
VWSAData: TWSAData;
|
||||||
|
VHostEnt: PHostEnt;
|
||||||
|
VName: string;
|
||||||
|
{$ENDIF}
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
{$IFDEF UNIX}
|
||||||
|
VStrTemp := TStringList.Create;
|
||||||
|
VProcess := TProcess.Create(nil);
|
||||||
|
try
|
||||||
|
VProcess.CommandLine :=
|
||||||
|
'sh -c "ifconfig eth0 | awk ''/inet end/ {print $3}''"';
|
||||||
|
VProcess.Options := [poWaitOnExit, poUsePipes];
|
||||||
|
VProcess.Execute;
|
||||||
|
VStrTemp.LoadFromStream(VProcess.Output);
|
||||||
|
Result := Trim(VStrTemp.Text);
|
||||||
|
finally
|
||||||
|
VStrTemp.Free;
|
||||||
|
VProcess.Free;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
{$HINTS OFF}
|
||||||
|
WSAStartup(2, VWSAData);
|
||||||
|
{$HINTS ON}
|
||||||
|
SetLength(VName, 255);
|
||||||
|
GetHostName(PChar(VName), 255);
|
||||||
|
SetLength(VName, StrLen(PChar(VName)));
|
||||||
|
VHostEnt := GetHostByName(PChar(VName));
|
||||||
|
with VHostEnt^ do
|
||||||
|
Result := Format(CFormatIPMask, [Byte(h_addr^[0]), Byte(h_addr^[1]),
|
||||||
|
Byte(h_addr^[2]), Byte(h_addr^[3])]);
|
||||||
|
WSACleanup;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -4,11 +4,11 @@
|
|||||||
<Version Value="9"/>
|
<Version Value="9"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
<ActiveWindowIndexAtStart Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
@ -34,17 +34,11 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="32">
|
<Units Count="7">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="fpchess.lpr"/>
|
<Filename Value="fpchess.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="fpchess"/>
|
<UnitName Value="fpchess"/>
|
||||||
<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"/>
|
||||||
@ -52,381 +46,33 @@
|
|||||||
<ComponentName Value="formChess"/>
|
<ComponentName Value="formChess"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="mainform"/>
|
<UnitName Value="mainform"/>
|
||||||
<EditorIndex Value="0"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="92"/>
|
|
||||||
<CursorPos X="1" Y="100"/>
|
|
||||||
<UsageCount Value="39"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
<LoadedDesigner Value="True"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
<Unit2>
|
<Unit2>
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\extctrls.pp"/>
|
|
||||||
<UnitName Value="ExtCtrls"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="309"/>
|
|
||||||
<CursorPos X="15" Y="326"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit2>
|
|
||||||
<Unit3>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\ideintf\componenteditors.pas"/>
|
|
||||||
<UnitName Value="ComponentEditors"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="864"/>
|
|
||||||
<CursorPos X="15" Y="877"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit3>
|
|
||||||
<Unit4>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\custompage.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="136"/>
|
|
||||||
<CursorPos X="1" Y="136"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit4>
|
|
||||||
<Unit5>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\customnotebook.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="195"/>
|
|
||||||
<CursorPos X="21" Y="207"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit5>
|
|
||||||
<Unit6>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\untabbednotebook.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="155"/>
|
|
||||||
<CursorPos X="36" Y="181"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit6>
|
|
||||||
<Unit7>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\ideintf\propedits.pp"/>
|
|
||||||
<UnitName Value="PropEdits"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="5323"/>
|
|
||||||
<CursorPos X="3" Y="5329"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit7>
|
|
||||||
<Unit8>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\page.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="24"/>
|
|
||||||
<CursorPos X="26" Y="50"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit8>
|
|
||||||
<Unit9>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\lconvencoding.pas"/>
|
|
||||||
<UnitName Value="LConvEncoding"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="10"/>
|
|
||||||
<CursorPos X="19" Y="15"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit9>
|
|
||||||
<Unit10>
|
|
||||||
<Filename Value="F:\JIL\AndroidJuliana\Widget\PIM\addCalendarItem\auto_001.js"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="5"/>
|
|
||||||
<CursorPos X="41" Y="31"/>
|
|
||||||
<UsageCount Value="9"/>
|
|
||||||
<DefaultSyntaxHighlighter Value="JScript"/>
|
|
||||||
</Unit10>
|
|
||||||
<Unit11>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\controls.pp"/>
|
|
||||||
<UnitName Value="Controls"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="305"/>
|
|
||||||
<CursorPos X="61" Y="320"/>
|
|
||||||
<UsageCount Value="19"/>
|
|
||||||
</Unit11>
|
|
||||||
<Unit12>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\notebook.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="9"/>
|
|
||||||
<CursorPos X="3" Y="40"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit12>
|
|
||||||
<Unit13>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\lcltype.pp"/>
|
|
||||||
<UnitName Value="LCLType"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="2728"/>
|
|
||||||
<CursorPos X="3" Y="2700"/>
|
|
||||||
<UsageCount Value="16"/>
|
|
||||||
</Unit13>
|
|
||||||
<Unit14>
|
|
||||||
<Filename Value="..\..\..\fpcsvn\rtl\arm\mathu.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="148"/>
|
|
||||||
<CursorPos X="15" Y="163"/>
|
|
||||||
<UsageCount Value="15"/>
|
|
||||||
</Unit14>
|
|
||||||
<Unit15>
|
|
||||||
<Filename Value="..\..\..\lazarus29\fpc\2.4.3\source\rtl\objpas\classes\classesh.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="595"/>
|
|
||||||
<CursorPos X="27" Y="612"/>
|
|
||||||
<UsageCount Value="14"/>
|
|
||||||
</Unit15>
|
|
||||||
<Unit16>
|
|
||||||
<Filename Value="chessdrawer.pas"/>
|
<Filename Value="chessdrawer.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="chessdrawer"/>
|
<UnitName Value="chessdrawer"/>
|
||||||
<EditorIndex Value="5"/>
|
</Unit2>
|
||||||
<WindowIndex Value="0"/>
|
<Unit3>
|
||||||
<TopLine Value="1"/>
|
|
||||||
<CursorPos X="3" Y="25"/>
|
|
||||||
<UsageCount Value="37"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit16>
|
|
||||||
<Unit17>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\lconvasiapage.pas"/>
|
|
||||||
<UnitName Value="LConvAsiaPage"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="2"/>
|
|
||||||
<CursorPos X="26" Y="18"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
</Unit17>
|
|
||||||
<Unit18>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\include\asiancodepagefunctions.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="18"/>
|
|
||||||
<CursorPos X="1" Y="37"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
</Unit18>
|
|
||||||
<Unit19>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\translations.pas"/>
|
|
||||||
<UnitName Value="Translations"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="43"/>
|
|
||||||
<CursorPos X="24" Y="66"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
</Unit19>
|
|
||||||
<Unit20>
|
|
||||||
<Filename Value="..\..\..\fpcsvn\packages\fpvectorial\src\pdfvrsemantico.pas"/>
|
|
||||||
<UnitName Value="pdfvrsemantico"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="210"/>
|
|
||||||
<CursorPos X="19" Y="230"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
</Unit20>
|
|
||||||
<Unit21>
|
|
||||||
<Filename Value="..\..\..\openssl-1.0.0a\crypto\pem\pem_pkey.c"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="55"/>
|
|
||||||
<CursorPos X="1" Y="76"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
<DefaultSyntaxHighlighter Value="C++"/>
|
|
||||||
</Unit21>
|
|
||||||
<Unit22>
|
|
||||||
<Filename Value="..\..\..\fpcsvn\packages\openssl\src\openssl.pas"/>
|
|
||||||
<UnitName Value="OpenSSL"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="634"/>
|
|
||||||
<CursorPos X="20" Y="656"/>
|
|
||||||
<UsageCount Value="13"/>
|
|
||||||
</Unit22>
|
|
||||||
<Unit23>
|
|
||||||
<Filename Value="chessgame.pas"/>
|
<Filename Value="chessgame.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="chessgame"/>
|
<UnitName Value="chessgame"/>
|
||||||
<EditorIndex Value="2"/>
|
</Unit3>
|
||||||
<WindowIndex Value="0"/>
|
<Unit4>
|
||||||
<TopLine Value="22"/>
|
|
||||||
<CursorPos X="1" Y="28"/>
|
|
||||||
<UsageCount Value="29"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit23>
|
|
||||||
<Unit24>
|
|
||||||
<Filename Value="chessconfig.pas"/>
|
<Filename Value="chessconfig.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="chessconfig"/>
|
<UnitName Value="chessconfig"/>
|
||||||
<EditorIndex Value="3"/>
|
</Unit4>
|
||||||
<WindowIndex Value="0"/>
|
<Unit5>
|
||||||
<TopLine Value="1"/>
|
|
||||||
<CursorPos X="14" Y="10"/>
|
|
||||||
<UsageCount Value="29"/>
|
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit24>
|
|
||||||
<Unit25>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\graphics.pp"/>
|
|
||||||
<UnitName Value="Graphics"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="217"/>
|
|
||||||
<CursorPos X="12" Y="232"/>
|
|
||||||
<UsageCount Value="11"/>
|
|
||||||
</Unit25>
|
|
||||||
<Unit26>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\intfgraphics.pas"/>
|
|
||||||
<UnitName Value="IntfGraphics"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="3455"/>
|
|
||||||
<CursorPos X="1" Y="3483"/>
|
|
||||||
<UsageCount Value="10"/>
|
|
||||||
</Unit26>
|
|
||||||
<Unit27>
|
|
||||||
<Filename Value="..\..\..\lazarus29\fpc\2.4.3\source\packages\fcl-image\src\fpimage.pp"/>
|
|
||||||
<UnitName Value="FPimage"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="10"/>
|
|
||||||
<CursorPos X="25" Y="31"/>
|
|
||||||
<UsageCount Value="10"/>
|
|
||||||
</Unit27>
|
|
||||||
<Unit28>
|
|
||||||
<Filename Value="..\..\..\fpcsvn\packages\fcl-image\src\fpcolors.inc"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="1"/>
|
|
||||||
<CursorPos X="15" Y="10"/>
|
|
||||||
<UsageCount Value="10"/>
|
|
||||||
</Unit28>
|
|
||||||
<Unit29>
|
|
||||||
<Filename Value="..\..\..\lazarussvn\lcl\interfaces\win32\win32wsbuttons.pp"/>
|
|
||||||
<UnitName Value="Win32WSButtons"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="296"/>
|
|
||||||
<CursorPos X="1" Y="313"/>
|
|
||||||
<UsageCount Value="10"/>
|
|
||||||
</Unit29>
|
|
||||||
<Unit30>
|
|
||||||
<Filename Value="..\..\..\fpctrunk\packages\fcl-image\src\fpimage.pp"/>
|
|
||||||
<UnitName Value="FPimage"/>
|
|
||||||
<WindowIndex Value="0"/>
|
|
||||||
<TopLine Value="18"/>
|
|
||||||
<CursorPos X="1" Y="30"/>
|
|
||||||
<UsageCount Value="10"/>
|
|
||||||
</Unit30>
|
|
||||||
<Unit31>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
<Filename Value="tcpcomm.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="tcpcomm"/>
|
<UnitName Value="tcpcomm"/>
|
||||||
<IsVisibleTab Value="True"/>
|
</Unit5>
|
||||||
<EditorIndex Value="1"/>
|
<Unit6>
|
||||||
<WindowIndex Value="0"/>
|
<Filename Value="chesstcputils.pas"/>
|
||||||
<TopLine Value="523"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<CursorPos X="1" Y="545"/>
|
<UnitName Value="chesstcputils"/>
|
||||||
<UsageCount Value="21"/>
|
</Unit6>
|
||||||
<Loaded Value="True"/>
|
|
||||||
</Unit31>
|
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
|
||||||
<Position1>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="270" Column="20" TopLine="259"/>
|
|
||||||
</Position1>
|
|
||||||
<Position2>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="261" Column="23" TopLine="248"/>
|
|
||||||
</Position2>
|
|
||||||
<Position3>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="138" Column="1" TopLine="124"/>
|
|
||||||
</Position3>
|
|
||||||
<Position4>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="94" Column="39" TopLine="81"/>
|
|
||||||
</Position4>
|
|
||||||
<Position5>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="99" Column="45" TopLine="81"/>
|
|
||||||
</Position5>
|
|
||||||
<Position6>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="110" Column="1" TopLine="108"/>
|
|
||||||
</Position6>
|
|
||||||
<Position7>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="92" Column="17" TopLine="81"/>
|
|
||||||
</Position7>
|
|
||||||
<Position8>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="144" Column="44" TopLine="131"/>
|
|
||||||
</Position8>
|
|
||||||
<Position9>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="151" Column="1" TopLine="138"/>
|
|
||||||
</Position9>
|
|
||||||
<Position10>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="39" Column="15" TopLine="21"/>
|
|
||||||
</Position10>
|
|
||||||
<Position11>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="36" Column="32" TopLine="16"/>
|
|
||||||
</Position11>
|
|
||||||
<Position12>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="145" Column="44" TopLine="132"/>
|
|
||||||
</Position12>
|
|
||||||
<Position13>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="24" Column="74" TopLine="17"/>
|
|
||||||
</Position13>
|
|
||||||
<Position14>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="61" Column="25" TopLine="45"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="48" Column="1" TopLine="35"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="178" Column="3" TopLine="165"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="258" Column="42" TopLine="245"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="262" Column="8" TopLine="245"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="257" Column="1" TopLine="237"/>
|
|
||||||
</Position19>
|
|
||||||
<Position20>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="273" Column="10" TopLine="256"/>
|
|
||||||
</Position20>
|
|
||||||
<Position21>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="665" Column="3" TopLine="649"/>
|
|
||||||
</Position21>
|
|
||||||
<Position22>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="291" Column="8" TopLine="273"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="303" Column="26" TopLine="290"/>
|
|
||||||
</Position23>
|
|
||||||
<Position24>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="382" Column="44" TopLine="367"/>
|
|
||||||
</Position24>
|
|
||||||
<Position25>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="410" Column="1" TopLine="393"/>
|
|
||||||
</Position25>
|
|
||||||
<Position26>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="369" Column="32" TopLine="356"/>
|
|
||||||
</Position26>
|
|
||||||
<Position27>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="435" Column="3" TopLine="424"/>
|
|
||||||
</Position27>
|
|
||||||
<Position28>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="47" Column="1" TopLine="30"/>
|
|
||||||
</Position28>
|
|
||||||
<Position29>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="486" Column="22" TopLine="473"/>
|
|
||||||
</Position29>
|
|
||||||
<Position30>
|
|
||||||
<Filename Value="tcpcomm.pas"/>
|
|
||||||
<Caret Line="543" Column="32" TopLine="519"/>
|
|
||||||
</Position30>
|
|
||||||
</JumpHistory>
|
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="9"/>
|
||||||
@ -446,6 +92,9 @@
|
|||||||
</Options>
|
</Options>
|
||||||
</Linking>
|
</Linking>
|
||||||
<Other>
|
<Other>
|
||||||
|
<CompilerMessages>
|
||||||
|
<UseMsgFile Value="True"/>
|
||||||
|
</CompilerMessages>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
</Other>
|
</Other>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
|
@ -7,7 +7,8 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, lnetvisual, mainform, chessdrawer, chessgame, chessconfig, tcpcomm;
|
Forms, lnetvisual, mainform, chessdrawer, chessgame, chessconfig, tcpcomm,
|
||||||
|
chesstcputils;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ object formChess: TformChess
|
|||||||
Height = 433
|
Height = 433
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 360
|
Width = 360
|
||||||
PageIndex = 1
|
PageIndex = 0
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
TabStop = True
|
TabStop = True
|
||||||
object pageStart: TUNBPage
|
object pageStart: TUNBPage
|
||||||
OnBeforeShow = pageStartBeforeShow
|
OnBeforeShow = pageBeforeShow
|
||||||
ClientWidth = 360
|
ClientWidth = 360
|
||||||
ClientHeight = 433
|
ClientHeight = 433
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
@ -72,7 +72,7 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
object editPlayerName: TLabeledEdit
|
object editPlayerName: TLabeledEdit
|
||||||
Left = 88
|
Left = 88
|
||||||
Height = 22
|
Height = 21
|
||||||
Top = 72
|
Top = 72
|
||||||
Width = 120
|
Width = 120
|
||||||
EditLabel.AnchorSideLeft.Control = editPlayerName
|
EditLabel.AnchorSideLeft.Control = editPlayerName
|
||||||
@ -80,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 = 6
|
EditLabel.Left = 24
|
||||||
EditLabel.Height = 17
|
EditLabel.Height = 14
|
||||||
EditLabel.Top = 75
|
EditLabel.Top = 75
|
||||||
EditLabel.Width = 79
|
EditLabel.Width = 61
|
||||||
EditLabel.Caption = 'Player Name'
|
EditLabel.Caption = 'Player Name'
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
@ -91,9 +91,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
object Label6: TLabel
|
object Label6: TLabel
|
||||||
Left = 28
|
Left = 28
|
||||||
Height = 17
|
Height = 14
|
||||||
Top = 104
|
Top = 104
|
||||||
Width = 52
|
Width = 43
|
||||||
Caption = 'Start as:'
|
Caption = 'Start as:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -102,7 +102,7 @@ object formChess: TformChess
|
|||||||
Height = 21
|
Height = 21
|
||||||
Top = 104
|
Top = 104
|
||||||
Width = 120
|
Width = 120
|
||||||
ItemHeight = 0
|
ItemHeight = 13
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'White'
|
'White'
|
||||||
@ -113,9 +113,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
object checkTimer: TCheckBox
|
object checkTimer: TCheckBox
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 18
|
Height = 17
|
||||||
Top = 136
|
Top = 136
|
||||||
Width = 212
|
Width = 163
|
||||||
Caption = 'Set a time limit for each Player'
|
Caption = 'Set a time limit for each Player'
|
||||||
Checked = True
|
Checked = True
|
||||||
State = cbChecked
|
State = cbChecked
|
||||||
@ -123,7 +123,7 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
object spinPlayerTime: TSpinEdit
|
object spinPlayerTime: TSpinEdit
|
||||||
Left = 21
|
Left = 21
|
||||||
Height = 16
|
Height = 21
|
||||||
Top = 160
|
Top = 160
|
||||||
Width = 50
|
Width = 50
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
@ -131,9 +131,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
object Label7: TLabel
|
object Label7: TLabel
|
||||||
Left = 80
|
Left = 80
|
||||||
Height = 17
|
Height = 14
|
||||||
Top = 163
|
Top = 163
|
||||||
Width = 150
|
Width = 114
|
||||||
Caption = 'minutes for each player'
|
Caption = 'minutes for each player'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -148,8 +148,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pageConfigConnection: TUNBPage
|
object pageConfigConnection: TUNBPage
|
||||||
ClientWidth = 360
|
OnBeforeShow = pageBeforeShow
|
||||||
ClientHeight = 433
|
ClientWidth = 2880
|
||||||
|
ClientHeight = 3464
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 32
|
Height = 32
|
||||||
@ -211,8 +212,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pageConnecting: TUNBPage
|
object pageConnecting: TUNBPage
|
||||||
ClientWidth = 1920
|
OnBeforeShow = pageBeforeShow
|
||||||
ClientHeight = 2400
|
ClientWidth = 15360
|
||||||
|
ClientHeight = 19200
|
||||||
object Label4: TLabel
|
object Label4: TLabel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 32
|
Height = 32
|
||||||
@ -234,8 +236,9 @@ object formChess: TformChess
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pageGame: TUNBPage
|
object pageGame: TUNBPage
|
||||||
ClientWidth = 960
|
OnBeforeShow = pageBeforeShow
|
||||||
ClientHeight = 1732
|
ClientWidth = 7680
|
||||||
|
ClientHeight = 13856
|
||||||
object Label5: TLabel
|
object Label5: TLabel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 32
|
Height = 32
|
||||||
|
@ -8,7 +8,7 @@ uses
|
|||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
ExtCtrls, ComCtrls, StdCtrls, Buttons, Spin,
|
ExtCtrls, ComCtrls, StdCtrls, Buttons, Spin,
|
||||||
//
|
//
|
||||||
chessdrawer, chessgame, chessconfig;
|
chessdrawer, chessgame, chessconfig, chesstcputils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -54,7 +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 pageBeforeShow(Sender: TObject; ANewPage: TUNBPage; ANewIndex: Integer);
|
||||||
procedure timerChessTimerTimer(Sender: TObject);
|
procedure timerChessTimerTimer(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
@ -71,28 +71,34 @@ implementation
|
|||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
const
|
||||||
|
INT_PAGE_START = 0;
|
||||||
|
INT_PAGE_CONFIGCONNECTION = 1;
|
||||||
|
INT_PAGE_CONNECTING = 2;
|
||||||
|
INT_PAGE_GAME = 3;
|
||||||
|
|
||||||
{ TformChess }
|
{ TformChess }
|
||||||
|
|
||||||
procedure TformChess.HandleMainScreenButton(Sender: TObject);
|
procedure TformChess.HandleMainScreenButton(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Sender = btnSinglePlayer then
|
if Sender = btnSinglePlayer then
|
||||||
begin
|
begin
|
||||||
notebookMain.PageIndex := 3;
|
notebookMain.PageIndex := INT_PAGE_GAME;
|
||||||
vChessGame.StartNewGame(comboStartColor.ItemIndex, checkTimer.Checked, spinPlayerTime.Value);
|
vChessGame.StartNewGame(comboStartColor.ItemIndex, checkTimer.Checked, spinPlayerTime.Value);
|
||||||
end
|
end
|
||||||
else if Sender = btnHotSeat then
|
else if Sender = btnHotSeat then
|
||||||
begin
|
begin
|
||||||
notebookMain.PageIndex := 3;
|
notebookMain.PageIndex := INT_PAGE_GAME;
|
||||||
vChessGame.StartNewGame(comboStartColor.ItemIndex, checkTimer.Checked, spinPlayerTime.Value);
|
vChessGame.StartNewGame(comboStartColor.ItemIndex, checkTimer.Checked, spinPlayerTime.Value);
|
||||||
end
|
end
|
||||||
else if Sender = btnDirectComm then notebookMain.PageIndex := 1;
|
else if Sender = btnDirectComm then notebookMain.PageIndex := INT_PAGE_CONFIGCONNECTION;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformChess.pageStartBeforeShow(Sender: TObject);
|
procedure TformChess.pageBeforeShow(Sender: TObject; ANewPage: TUNBPage; ANewIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if notebookMain.PageIndex = 1 then
|
if ANewIndex = INT_PAGE_CONFIGCONNECTION then
|
||||||
begin
|
begin
|
||||||
editLocalIP.Text := '';
|
editLocalIP.Text := ChessGetLocalIP();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user