2017-06-20 04:24:15 +00:00
|
|
|
#include "Settings.hpp"
|
2017-08-18 04:13:08 +00:00
|
|
|
|
2017-06-20 04:24:15 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include <components/openmw-mp/Log.hpp>
|
|
|
|
|
2017-08-18 04:13:08 +00:00
|
|
|
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
|
|
|
#include <apps/openmw-mp/Networking.hpp>
|
|
|
|
|
2017-06-20 04:24:15 +00:00
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
2017-11-27 05:39:02 +00:00
|
|
|
void SettingFunctions::SetDifficulty(unsigned short pid, int difficulty)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
player->difficulty = difficulty;
|
|
|
|
}
|
|
|
|
|
2018-03-11 02:50:59 +00:00
|
|
|
void SettingFunctions::SetEnforcedLogLevel(unsigned short pid, int enforcedLogLevel)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
player->enforcedLogLevel = enforcedLogLevel;
|
|
|
|
}
|
|
|
|
|
2018-02-14 03:53:44 +00:00
|
|
|
void SettingFunctions::SetPhysicsFramerate(unsigned short pid, double physicsFramerate)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
player->physicsFramerate = physicsFramerate;
|
|
|
|
}
|
|
|
|
|
2017-11-27 05:39:02 +00:00
|
|
|
void SettingFunctions::SetConsoleAllowed(unsigned short pid, bool state)
|
2017-06-20 04:24:15 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player,);
|
|
|
|
|
|
|
|
player->consoleAllowed = state;
|
|
|
|
}
|
|
|
|
|
2017-11-30 10:18:15 +00:00
|
|
|
void SettingFunctions::SetBedRestAllowed(unsigned short pid, bool state)
|
2017-06-20 04:24:15 +00:00
|
|
|
{
|
|
|
|
Player *player;
|
2017-11-27 05:39:02 +00:00
|
|
|
GET_PLAYER(pid, player, );
|
2017-06-20 04:24:15 +00:00
|
|
|
|
2017-11-30 10:18:15 +00:00
|
|
|
player->bedRestAllowed = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingFunctions::SetWildernessRestAllowed(unsigned short pid, bool state)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
player->wildernessRestAllowed = state;
|
2017-11-27 05:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SettingFunctions::SetWaitAllowed(unsigned short pid, bool state)
|
|
|
|
{
|
|
|
|
Player *player;
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
player->waitAllowed = state;
|
2017-06-20 04:24:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|