[Server] Create new Settings category for script functions
parent
ebf7740969
commit
4ad87faac1
@ -0,0 +1,33 @@
|
||||
#include "Settings.hpp"
|
||||
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
void SettingFunctions::SetConsoleAllow(unsigned short pid, bool state)
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->consoleAllowed = state;
|
||||
}
|
||||
|
||||
void SettingFunctions::SetDifficulty(unsigned short pid, int difficulty)
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->difficulty = difficulty;
|
||||
}
|
||||
|
||||
void SettingFunctions::SendSettings(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_SETTINGS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_SETTINGS)->Send(false);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
#ifndef OPENMW_SETTINGSAPI_HPP
|
||||
#define OPENMW_SETTINGSAPI_HPP
|
||||
|
||||
#include "../Types.hpp"
|
||||
|
||||
#define SETTINGSAPI \
|
||||
{"SetConsoleAllow", SettingFunctions::SetConsoleAllow},\
|
||||
{"SetDifficulty", SettingFunctions::SetDifficulty},\
|
||||
\
|
||||
{"SendSettings", SettingFunctions::SendSettings}
|
||||
|
||||
class SettingFunctions
|
||||
{
|
||||
public:
|
||||
static void SetConsoleAllow(unsigned short pid, bool state);
|
||||
static void SetDifficulty(unsigned short pid, int difficulty);
|
||||
|
||||
static void SendSettings(unsigned short pid) noexcept;
|
||||
};
|
||||
|
||||
#endif //OPENMW_SETTINGSAPI_HPP
|
Loading…
Reference in New Issue