2017-06-20 02:28:45 +00:00
|
|
|
#include "PacketGameSettings.hpp"
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
PacketGameSettings::PacketGameSettings(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
|
|
{
|
|
|
|
packetID = ID_GAME_SETTINGS;
|
|
|
|
orderChannel = CHANNEL_SYSTEM;
|
|
|
|
}
|
|
|
|
|
2019-12-04 08:17:33 +00:00
|
|
|
void PacketGameSettings::Packet(RakNet::BitStream *newBitstream, bool send)
|
2017-06-20 02:28:45 +00:00
|
|
|
{
|
2019-12-04 08:17:33 +00:00
|
|
|
PlayerPacket::Packet(newBitstream, send);
|
2017-06-20 02:28:45 +00:00
|
|
|
|
|
|
|
RW(player->difficulty, send);
|
2017-11-27 05:39:02 +00:00
|
|
|
RW(player->consoleAllowed, send);
|
2017-11-30 10:18:15 +00:00
|
|
|
RW(player->bedRestAllowed, send);
|
|
|
|
RW(player->wildernessRestAllowed, send);
|
2017-11-27 05:39:02 +00:00
|
|
|
RW(player->waitAllowed, send);
|
2018-03-11 02:50:59 +00:00
|
|
|
RW(player->enforcedLogLevel, send);
|
|
|
|
RW(player->physicsFramerate, send);
|
2020-02-27 23:40:00 +00:00
|
|
|
|
|
|
|
uint32_t gameSettingCount = static_cast<uint32_t>(player->gameSettings.size());
|
|
|
|
RW(gameSettingCount, send);
|
|
|
|
|
|
|
|
std::string mapIndex;
|
|
|
|
std::string mapValue;
|
|
|
|
|
|
|
|
if (send)
|
|
|
|
{
|
|
|
|
for (auto&& gameSetting : player->gameSettings)
|
|
|
|
{
|
|
|
|
mapIndex = gameSetting.first;
|
|
|
|
mapValue = gameSetting.second;
|
|
|
|
RW(mapIndex, send, false);
|
|
|
|
RW(mapValue, send, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
player->gameSettings.clear();
|
|
|
|
for (unsigned int n = 0; n < gameSettingCount; n++)
|
|
|
|
{
|
|
|
|
RW(mapIndex, send, false);
|
|
|
|
RW(mapValue, send, false);
|
|
|
|
player->gameSettings[mapIndex] = mapValue;
|
|
|
|
}
|
|
|
|
}
|
2017-06-20 02:28:45 +00:00
|
|
|
}
|