-
Notifications
You must be signed in to change notification settings - Fork 1
/
Server.h
69 lines (61 loc) · 2.05 KB
/
Server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//---------------------------------------------------------------------------
#ifndef ServerH
#define ServerH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ScktComp.hpp>
#include "CurrEdit.hpp"
#include "Placemnt.hpp"
#include "ToolEdit.hpp"
#include <Mask.hpp>
#include <ComCtrls.hpp>
#include <vector>
//---------------------------------------------------------------------------
class TServerNetPlayer;
class TfmServer : public TForm
{
__published: // IDE-managed Components
TServerSocket *ServerSocket1;
TButton *btGo;
TListBox *lbPlayers;
TCurrencyEdit *edPort;
TLabel *Label1;
TFormStorage *FormStorage1;
TButton *btDraft;
TStatusBar *StatusBar1;
void __fastcall ServerSocket1ClientConnect(TObject *Sender,
TCustomWinSocket *Socket);
void __fastcall ServerSocket1ClientDisconnect(TObject *Sender,
TCustomWinSocket *Socket);
void __fastcall ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket);
void __fastcall btDraftClick(TObject *Sender);
void __fastcall btGoClick(TObject *Sender);
private: // User declarations
struct TConnection
{
TCustomWinSocket* Socket;
//AnsiString Name;
AnsiString Buffer;
TConnection(TCustomWinSocket* aSocket)
: Socket(aSocket)
{}
};
std::vector<TConnection> Connections;
int FindConnection(TCustomWinSocket*) const;
int FindPlayer(TCustomWinSocket*) const;
public: // User declarations
std::vector<TServerNetPlayer*> NetPlayers;
bool WaitingForReconnect;
__fastcall TfmServer(TComponent* Owner);
void Start();
void Stop();
};
//---------------------------------------------------------------------------
extern PACKAGE TfmServer *fmServer;
void ConnectDraftServer();
//---------------------------------------------------------------------------
#endif