You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw-mp/Script/Functions/Settings.cpp

36 lines
908 B
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::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);
}