diff options
| author | Dark1-dev <shansarkar272@gmail.com> | 2023-03-01 21:32:53 +0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-01 21:32:53 +0600 |
| commit | de57bc38217c09a0ae4a143f631896652368ecc3 (patch) | |
| tree | 635e3f429a5a6e00744b6817533615e41c6db5e2 /src/Core/CoreObject | |
| parent | 60a301a93b6057bb2c54ac04a7c38c38389037b3 (diff) | |
| download | Masterserver-Qt5-de57bc38217c09a0ae4a143f631896652368ecc3.tar.gz Masterserver-Qt5-de57bc38217c09a0ae4a143f631896652368ecc3.zip | |
Add files via upload
Diffstat (limited to 'src/Core/CoreObject')
| -rw-r--r-- | src/Core/CoreObject/coreobject.cpp | 5 | ||||
| -rw-r--r-- | src/Core/CoreObject/coreobject.h | 30 | ||||
| -rw-r--r-- | src/Core/CoreObject/serverinfostructure.h | 31 |
3 files changed, 66 insertions, 0 deletions
diff --git a/src/Core/CoreObject/coreobject.cpp b/src/Core/CoreObject/coreobject.cpp new file mode 100644 index 0000000..11d1ab6 --- /dev/null +++ b/src/Core/CoreObject/coreobject.cpp @@ -0,0 +1,5 @@ +#include "coreobject.h" + +CoreObject::CoreObject() +{ +} diff --git a/src/Core/CoreObject/coreobject.h b/src/Core/CoreObject/coreobject.h new file mode 100644 index 0000000..91bd33b --- /dev/null +++ b/src/Core/CoreObject/coreobject.h @@ -0,0 +1,30 @@ +#ifndef COREOBJECT_H +#define COREOBJECT_H + +#include "Core/CoreObject/serverinfostructure.h" +#include "Core/GameInfo/gameinfostructure.h" +#include "Logger/logger.h" +#include "Settings/settingstructure.h" + +class CoreObject +{ +public: + CoreObject(); + + // struct with internal and external settings + SettingStructure Settings; + + // list of game details: gamename, cipher + QHash<QString, GameInfo> SupportedGames; + + // logging functions + Logger Log; + + // server address list acquired through third party masterservers + QList<ServerInfo> PendingServers; + + // generate our session/identification string, to prevent self-syncing + QString masterserverIdentity; // msid value +}; + +#endif // COREOBJECT_H diff --git a/src/Core/CoreObject/serverinfostructure.h b/src/Core/CoreObject/serverinfostructure.h new file mode 100644 index 0000000..4f86adb --- /dev/null +++ b/src/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 |
