[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 <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp>
#include <components/openmw-mp/Log.hpp>
#include <iostream>
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);
}

View file

@ -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