1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 00:49:54 +00:00
openmw-tes3mp/apps/openmw-mp/Script/Functions/Settings.cpp
David Cernat b249162ca1 [General] Implement setting of enforced client log level in GameSettings
Certain servers do not want the players to have debug information about the locations and actions of other players, so a client's log level can now be enforced by the server via the GameSettings packet.
2018-03-11 04:50:59 +02:00

75 lines
1.8 KiB
C++

#include "Settings.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp>
#include <iostream>
using namespace std;
void SettingFunctions::SetDifficulty(unsigned short pid, int difficulty)
{
Player *player;
GET_PLAYER(pid, player, );
player->difficulty = difficulty;
}
void SettingFunctions::SetEnforcedLogLevel(unsigned short pid, int enforcedLogLevel)
{
Player *player;
GET_PLAYER(pid, player, );
player->enforcedLogLevel = enforcedLogLevel;
}
void SettingFunctions::SetPhysicsFramerate(unsigned short pid, double physicsFramerate)
{
Player *player;
GET_PLAYER(pid, player, );
player->physicsFramerate = physicsFramerate;
}
void SettingFunctions::SetConsoleAllowed(unsigned short pid, bool state)
{
Player *player;
GET_PLAYER(pid, player,);
player->consoleAllowed = state;
}
void SettingFunctions::SetBedRestAllowed(unsigned short pid, bool state)
{
Player *player;
GET_PLAYER(pid, player, );
player->bedRestAllowed = state;
}
void SettingFunctions::SetWildernessRestAllowed(unsigned short pid, bool state)
{
Player *player;
GET_PLAYER(pid, player, );
player->wildernessRestAllowed = state;
}
void SettingFunctions::SetWaitAllowed(unsigned short pid, bool state)
{
Player *player;
GET_PLAYER(pid, player, );
player->waitAllowed = state;
}
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);
}