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

pull/199/head
David Cernat 8 years ago
parent 1d2a6d9056
commit 174937f412

@ -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);
}

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

Loading…
Cancel
Save