diff options
| author | Dark1-dev <shansarkar272@gmail.com> | 2023-03-01 21:33:55 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-01 21:33:55 +0600 |
| commit | 3c7253d6cdc23aac36208fa87dc6571c7cb7c5ff (patch) | |
| tree | 8b5f9425bbfc4fdd5a29155aec38893b77481359 /Core/CoreObject/serverinfostructure.h | |
| parent | de57bc38217c09a0ae4a143f631896652368ecc3 (diff) | |
| download | Masterserver-Qt5-3c7253d6cdc23aac36208fa87dc6571c7cb7c5ff.tar.gz Masterserver-Qt5-3c7253d6cdc23aac36208fa87dc6571c7cb7c5ff.zip | |
Add files via upload
Diffstat (limited to 'Core/CoreObject/serverinfostructure.h')
| -rw-r--r-- | Core/CoreObject/serverinfostructure.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Core/CoreObject/serverinfostructure.h b/Core/CoreObject/serverinfostructure.h new file mode 100644 index 0000000..4f86adb --- /dev/null +++ b/Core/CoreObject/serverinfostructure.h @@ -0,0 +1,31 @@ +#ifndef SERVERINFOSTRUCTURE_H +#define SERVERINFOSTRUCTURE_H + +#include <QDateTime> +#include <QHostAddress> + +struct ServerInfo +{ + // server address + QHostAddress ip; + + // server port + unsigned short port = 0; + + // gamename + QString gamename = ""; + + // date that the serverinfo was added or last updated + qint64 time = QDateTime::currentSecsSinceEpoch(); +}; + +// compare operator +inline bool operator== (const ServerInfo serverInfo1, const ServerInfo serverInfo2) +{ + // compare address, port and gamename. ignore time. + return ( serverInfo1.ip.isEqual(serverInfo2.ip) and + serverInfo1.port == serverInfo2.port and + serverInfo1.gamename == serverInfo2.gamename ); +} + +#endif // SERVERINFOSTRUCTURE_H |
