1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +00:00

[Server] Add LogMessage() and LogAppend() script functions

This commit is contained in:
David Cernat 2017-04-04 01:47:37 +03:00
parent 1d2a6d9056
commit 174937f412
2 changed files with 18 additions and 2 deletions

View file

@ -1,6 +1,7 @@
#include "Miscellaneous.hpp" #include "Miscellaneous.hpp"
#include <apps/openmw-mp/Script/ScriptFunctions.hpp> #include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp> #include <apps/openmw-mp/Networking.hpp>
#include <components/openmw-mp/Log.hpp>
#include <iostream> #include <iostream>
using namespace std; using namespace std;
@ -9,3 +10,13 @@ unsigned int MiscellaneousFunctions::GetLastPlayerId() noexcept
{ {
return Players::getLastPlayerId(); 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);
}

View file

@ -4,13 +4,18 @@
#include "../Types.hpp" #include "../Types.hpp"
#define MISCELLANEOUSAPI \ #define MISCELLANEOUSAPI \
{"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId} {"GetLastPlayerId", MiscellaneousFunctions::GetLastPlayerId},\
\
{"LogMessage", MiscellaneousFunctions::LogMessage},\
{"LogAppend", MiscellaneousFunctions::LogAppend}
class MiscellaneousFunctions class MiscellaneousFunctions
{ {
public: public:
static unsigned int GetLastPlayerId() noexcept; 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 #endif //OPENMW_MISCELLANEOUSAPI_HPP