From fa1700e2ab6323f906f49b0d6426a484c5991aed Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 17 Dec 2018 11:32:31 +0200 Subject: [PATCH] [Server] Add GetOperatingSystemType() script function --- apps/openmw-mp/Script/Functions/Server.cpp | 5 +++++ apps/openmw-mp/Script/Functions/Server.hpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/apps/openmw-mp/Script/Functions/Server.cpp b/apps/openmw-mp/Script/Functions/Server.cpp index 5f188b61a..3c8a795dc 100644 --- a/apps/openmw-mp/Script/Functions/Server.cpp +++ b/apps/openmw-mp/Script/Functions/Server.cpp @@ -34,6 +34,11 @@ void ServerFunctions::UnbanAddress(const char *ipAddress) noexcept mwmp::Networking::getPtr()->unbanAddress(ipAddress); } +const char *ServerFunctions::GetOperatingSystemType() noexcept +{ + return Utils::getOperatingSystem().c_str(); +} + const char *ServerFunctions::GetServerVersion() noexcept { return TES3MP_VERSION; diff --git a/apps/openmw-mp/Script/Functions/Server.hpp b/apps/openmw-mp/Script/Functions/Server.hpp index 7d4b0f10f..371be142e 100644 --- a/apps/openmw-mp/Script/Functions/Server.hpp +++ b/apps/openmw-mp/Script/Functions/Server.hpp @@ -10,6 +10,7 @@ {"BanAddress", ServerFunctions::BanAddress},\ {"UnbanAddress", ServerFunctions::UnbanAddress},\ \ + {"GetOperatingSystemType", ServerFunctions::GetOperatingSystemType},\ {"GetServerVersion", ServerFunctions::GetServerVersion},\ {"GetProtocolVersion", ServerFunctions::GetProtocolVersion},\ {"GetAvgPing", ServerFunctions::GetAvgPing},\ @@ -65,6 +66,15 @@ public: */ static void UnbanAddress(const char *ipAddress) noexcept; + /** + * \brief Get the type of the operating system used by the server. + * + * Note: Currently, the type can be "Windows", "Linux", "OS X" or "Unknown OS". + * + * \return The type of the operating system. + */ + static const char *GetOperatingSystemType() noexcept; + /** * \brief Get the TES3MP version of the server. *