From 174937f412075044de4efc7859fc9134c0422ad7 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 4 Apr 2017 01:47:37 +0300 Subject: [PATCH] [Server] Add LogMessage() and LogAppend() script functions --- apps/openmw-mp/Script/Functions/Miscellaneous.cpp | 11 +++++++++++ apps/openmw-mp/Script/Functions/Miscellaneous.hpp | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Miscellaneous.cpp b/apps/openmw-mp/Script/Functions/Miscellaneous.cpp index 7dfcaf48d..df8b70748 100644 --- a/apps/openmw-mp/Script/Functions/Miscellaneous.cpp +++ b/apps/openmw-mp/Script/Functions/Miscellaneous.cpp @@ -1,6 +1,7 @@ #include "Miscellaneous.hpp" #include #include +#include #include using namespace std; @@ -9,3 +10,13 @@ unsigned int MiscellaneousFunctions::GetLastPlayerId() noexcept { return Players::getLastPlayerId(); } + +void MiscellaneousFunctions::LogMessage(unsigned short level, const char *message) noexcept +{ + LOG_MESSAGE_SIMPLE(level, "[Script]: %s", message); +} + +void MiscellaneousFunctions::LogAppend(unsigned short level, const char *message) noexcept +{ + LOG_APPEND(level, "[Script]: %s", message); +} diff --git a/apps/openmw-mp/Script/Functions/Miscellaneous.hpp b/apps/openmw-mp/Script/Functions/Miscellaneous.hpp index c9509713c..668659515 100644 --- a/apps/openmw-mp/Script/Functions/Miscellaneous.hpp +++ b/apps/openmw-mp/Script/Functions/Miscellaneous.hpp @@ -4,13 +4,18 @@ #include "../Types.hpp" #define MISCELLANEOUSAPI \ - {"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId} - + {"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId},\ + \ + {"LogMessage", MiscellaneousFunctions::LogMessage},\ + {"LogAppend", MiscellaneousFunctions::LogAppend} class MiscellaneousFunctions { public: static unsigned int GetLastPlayerId() noexcept; + + static void LogMessage(unsigned short level, const char *message) noexcept; + static void LogAppend(unsigned short level, const char *message) noexcept; }; #endif //OPENMW_MISCELLANEOUSAPI_HPP