-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathServers.cpp
94 lines (85 loc) · 2.82 KB
/
Servers.cpp
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: SERVERS.CPP
** COMPONENT: The Application
** DESCRIPTION: CServers class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "Servers.hpp"
/******************************************************************************
** Method: Constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CServers::CServers()
: CTable(TXT("Servers"))
{
// Create the table schema.
AddColumn(TXT("ID"), MDCT_IDENTITY, 0, CColumn::IDENTITY);
AddColumn(TXT("IPKey"), MDCT_FXDSTR, IP_KEY_LEN, CColumn::UNIQUE );
AddColumn(TXT("IPAddress"), MDCT_FXDSTR, IP_ADDRESS_LEN, CColumn::DEFAULTS);
AddColumn(TXT("IPPort"), MDCT_INT, 0, CColumn::DEFAULTS);
AddColumn(TXT("HostName"), MDCT_VARSTR, HOST_NAME_LEN, CColumn::DEFAULTS);
AddColumn(TXT("MapTitle"), MDCT_VARSTR, MAP_TITLE_LEN, CColumn::DEFAULTS);
AddColumn(TXT("MapName"), MDCT_VARSTR, MAP_NAME_LEN, CColumn::DEFAULTS);
AddColumn(TXT("GameType"), MDCT_VARSTR, GAME_TYPE_LEN, CColumn::DEFAULTS);
AddColumn(TXT("ModName"), MDCT_VARSTR, MOD_NAME_LEN, CColumn::DEFAULTS);
AddColumn(TXT("NumPlayers"), MDCT_INT, 0, CColumn::DEFAULTS);
AddColumn(TXT("MaxPlayers"), MDCT_INT, 0, CColumn::DEFAULTS);
AddColumn(TXT("PingTime"), MDCT_INT, 0, CColumn::DEFAULTS);
AddColumn(TXT("LastError"), MDCT_INT, 0, CColumn::DEFAULTS);
AddColumn(TXT("FavID"), MDCT_INT, 0, CColumn::NULLABLE);
}
/******************************************************************************
** Method: Destructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CServers::~CServers()
{
}
/******************************************************************************
** Method: CreateRow()
**
** Description: Creates a new row and initialises it.
**
** Parameters: None.
**
** Returns: The new row.
**
*******************************************************************************
*/
CRow& CServers::CreateRow()
{
CRow& oRow = CTable::CreateRow();
// oRow[ID] =
oRow[IP_KEY] = TXT("");
oRow[IP_ADDRESS] = TXT("");
oRow[IP_PORT] = 0;
oRow[HOST_NAME] = TXT("");
oRow[MAP_TITLE] = TXT("");
oRow[MAP_NAME] = TXT("");
oRow[GAME_TYPE] = TXT("");
oRow[MOD_NAME] = TXT("");
oRow[NUM_PLAYERS] = 0;
oRow[MAX_PLAYERS] = 0;
oRow[PING_TIME] = 999;
oRow[LAST_ERROR] = ERROR_NONE;
oRow[FAV_ID] = null;
return oRow;
}