we need more server list classes with slightly different properties
This commit is contained in:
parent
5ca224af19
commit
53e8cabdbe
4 changed files with 96 additions and 58 deletions
|
@ -555,16 +555,8 @@ bool CProtocol::ParseConnectionLessMessage ( const CVector<uint8_t>& vecbyData,
|
|||
// TODO
|
||||
break;
|
||||
|
||||
case PROTMESSID_CLM_EMPTY_MESSAGE:
|
||||
// TODO
|
||||
break;
|
||||
|
||||
case PROTMESSID_CLM_REGISTER_SERVER:
|
||||
// TODO
|
||||
break;
|
||||
|
||||
case PROTMESSID_CLM_UNREGISTER_SERVER:
|
||||
// TODO
|
||||
bRet = EvaluateCLRegisterServerMes ( InetAddr, vecData );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1130,7 +1122,7 @@ bool CProtocol::EvaluateCLServerFullMes()
|
|||
}
|
||||
|
||||
void CProtocol::CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||
const CServerInfo& ServerInfo )
|
||||
const CServerCoreInfo& ServerInfo )
|
||||
{
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
|
@ -1187,7 +1179,7 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
|||
{
|
||||
int iPos = 0; // init position pointer
|
||||
const int iDataLen = vecData.Size();
|
||||
CServerInfo RecServerInfo;
|
||||
CServerCoreInfo RecServerInfo;
|
||||
|
||||
// check size (the first 5 bytes)
|
||||
if ( iDataLen < 5 )
|
||||
|
@ -1250,6 +1242,21 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
|||
}
|
||||
|
||||
|
||||
void CProtocol::CreateCLServerListMes ( const CHostAddress& InetAddr,
|
||||
const CVector<CServerInfo> vecServerInfo )
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/*
|
||||
bool CProtocol::EvaluateCLServerListMes ( const CHostAddress& InetAddr,
|
||||
const CVector<uint8_t>& vecData )
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************\
|
||||
* Message generation and parsing *
|
||||
\******************************************************************************/
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#define PROTMESSID_CLM_SEND_EMPTY_MESSAGE 1005 // an empty message shall be send
|
||||
#define PROTMESSID_CLM_EMPTY_MESSAGE 1006 // empty message
|
||||
#define PROTMESSID_CLM_REGISTER_SERVER 1007 // register server
|
||||
#define PROTMESSID_CLM_UNREGISTER_SERVER 1008 // unregister server
|
||||
#define PROTMESSID_CLM_UNREGISTER_SERVER 1008 // unregister server -> TODO
|
||||
|
||||
|
||||
// lengths of message as defined in protocol.cpp file
|
||||
|
@ -98,7 +98,9 @@ public:
|
|||
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
||||
void CreateCLServerFullMes ( const CHostAddress& InetAddr );
|
||||
void CreateCLRegisterServerMes ( const CHostAddress& InetAddr,
|
||||
const CServerInfo& ServerInfo );
|
||||
const CServerCoreInfo& ServerInfo );
|
||||
void CreateCLServerListMes ( const CHostAddress& InetAddr,
|
||||
const CVector<CServerInfo> vecServerInfo );
|
||||
|
||||
void CreateAndImmSendDisconnectionMes();
|
||||
void CreateAndImmSendAcknMess ( const int& iID,
|
||||
|
@ -238,7 +240,8 @@ signals:
|
|||
void Disconnection();
|
||||
|
||||
void CLPingReceived ( CHostAddress InetAddr, int iMs );
|
||||
void CLRegisterServerReceived ( CHostAddress InetAddr, CServerInfo ServerInfo );
|
||||
void CLRegisterServerReceived ( CHostAddress InetAddr,
|
||||
CServerCoreInfo ServerInfo );
|
||||
};
|
||||
|
||||
#endif /* !defined ( PROTOCOL_H__3B123453_4344_BB2392354455IUHF1912__INCLUDED_ ) */
|
||||
|
|
|
@ -70,11 +70,12 @@ private network.
|
|||
|
||||
|
||||
/* Classes ********************************************************************/
|
||||
class CServerListProperties
|
||||
class CServerListEntry : public CServerInfo
|
||||
{
|
||||
public:
|
||||
CServerListProperties() :
|
||||
ServerInfo ( "",
|
||||
CServerListEntry() :
|
||||
CServerInfo ( CHostAddress(),
|
||||
"",
|
||||
"",
|
||||
QLocale::AnyCountry,
|
||||
"",
|
||||
|
@ -82,7 +83,7 @@ public:
|
|||
0,
|
||||
false ) { RegisterTime.start(); }
|
||||
|
||||
CServerListProperties ( const CHostAddress& NIAddr,
|
||||
CServerListEntry ( const CHostAddress& NIAddr,
|
||||
const QString& NsName,
|
||||
const QString& NsTopic,
|
||||
const QLocale::Country& NeCountry,
|
||||
|
@ -90,27 +91,20 @@ public:
|
|||
const int NiNumClients,
|
||||
const int NiMaxNumClients,
|
||||
const bool NbPermOnline)
|
||||
: InetAddr ( NIAddr ), ServerInfo ( NsName,
|
||||
: CServerInfo ( NIAddr,
|
||||
NsName,
|
||||
NsTopic,
|
||||
NeCountry,
|
||||
NsCity,
|
||||
NiNumClients,
|
||||
NiMaxNumClients,
|
||||
NbPermOnline )
|
||||
{ RegisterTime.start(); }
|
||||
NbPermOnline ) { RegisterTime.start(); }
|
||||
|
||||
public:
|
||||
// time on which the entry was registered
|
||||
QTime RegisterTime;
|
||||
|
||||
// internet address of the server
|
||||
CHostAddress InetAddr;
|
||||
|
||||
// infos of the server
|
||||
CServerInfo ServerInfo;
|
||||
};
|
||||
|
||||
|
||||
class CServerListManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -121,7 +115,7 @@ public:
|
|||
protected:
|
||||
QTimer TimerPollList;
|
||||
QMutex Mutex;
|
||||
QList<CServerListProperties> ServerList;
|
||||
QList<CServerListEntry> ServerList;
|
||||
bool bEnabled;
|
||||
|
||||
public slots:
|
||||
|
|
40
src/util.h
40
src/util.h
|
@ -452,10 +452,10 @@ public:
|
|||
|
||||
|
||||
// Server info -----------------------------------------------------------------
|
||||
class CServerInfo
|
||||
class CServerCoreInfo
|
||||
{
|
||||
public:
|
||||
CServerInfo() :
|
||||
CServerCoreInfo() :
|
||||
strName ( "" ),
|
||||
strTopic ( "" ),
|
||||
eCountry ( QLocale::AnyCountry ),
|
||||
|
@ -464,7 +464,7 @@ public:
|
|||
iMaxNumClients ( 0 ),
|
||||
bPermanentOnline ( false ) {}
|
||||
|
||||
CServerInfo (
|
||||
CServerCoreInfo (
|
||||
const QString& NsName,
|
||||
const QString& NsTopic,
|
||||
const QLocale::Country& NeCountry,
|
||||
|
@ -504,6 +504,40 @@ public:
|
|||
bool bPermanentOnline;
|
||||
};
|
||||
|
||||
class CServerInfo : public CServerCoreInfo
|
||||
{
|
||||
public:
|
||||
CServerInfo() :
|
||||
CServerCoreInfo ( "",
|
||||
"",
|
||||
QLocale::AnyCountry,
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
false ), InetAddr ( CHostAddress() ) {}
|
||||
|
||||
CServerInfo (
|
||||
const CHostAddress& NIAddr,
|
||||
const QString& NsName,
|
||||
const QString& NsTopic,
|
||||
const QLocale::Country& NeCountry,
|
||||
const QString& NsCity,
|
||||
const int NiNumClients,
|
||||
const int NiMaxNumClients,
|
||||
const bool NbPermOnline) :
|
||||
CServerCoreInfo ( NsName,
|
||||
NsTopic,
|
||||
NeCountry,
|
||||
NsCity,
|
||||
NiNumClients,
|
||||
NiMaxNumClients,
|
||||
NbPermOnline ), InetAddr ( NIAddr ) {}
|
||||
|
||||
public:
|
||||
// internet address of the server
|
||||
CHostAddress InetAddr;
|
||||
};
|
||||
|
||||
|
||||
// Audio compression type enum -------------------------------------------------
|
||||
enum EAudComprType
|
||||
|
|
Loading…
Reference in a new issue