|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
#include <components/openmw-mp/Base/BaseWorldstate.hpp>
|
|
|
|
|
|
|
|
|
|
#include <apps/openmw-mp/Networking.hpp>
|
|
|
|
|
#include <apps/openmw-mp/Player.hpp>
|
|
|
|
@ -6,20 +7,24 @@
|
|
|
|
|
|
|
|
|
|
#include "Worldstate.hpp"
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
|
|
|
|
|
BaseWorldstate writeWorldstate;
|
|
|
|
|
|
|
|
|
|
void WorldstateFunctions::SetHour(unsigned short pid, double hour) noexcept
|
|
|
|
|
{
|
|
|
|
|
Player *player;
|
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
|
|
player->hour = hour;
|
|
|
|
|
player->month = -1;
|
|
|
|
|
player->day = -1;
|
|
|
|
|
writeWorldstate.guid = player->guid;
|
|
|
|
|
|
|
|
|
|
writeWorldstate.hour = hour;
|
|
|
|
|
writeWorldstate.month = -1;
|
|
|
|
|
writeWorldstate.day = -1;
|
|
|
|
|
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate);
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept
|
|
|
|
@ -27,12 +32,14 @@ void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept
|
|
|
|
|
Player *player;
|
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
|
|
player->hour = -1;
|
|
|
|
|
player->month = month;
|
|
|
|
|
player->day = -1;
|
|
|
|
|
writeWorldstate.guid = player->guid;
|
|
|
|
|
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
writeWorldstate.hour = -1;
|
|
|
|
|
writeWorldstate.month = month;
|
|
|
|
|
writeWorldstate.day = -1;
|
|
|
|
|
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate);
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -41,10 +48,12 @@ void WorldstateFunctions::SetDay(unsigned short pid, int day) noexcept
|
|
|
|
|
Player *player;
|
|
|
|
|
GET_PLAYER(pid, player, );
|
|
|
|
|
|
|
|
|
|
player->hour = -1;
|
|
|
|
|
player->month = -1;
|
|
|
|
|
player->day = day;
|
|
|
|
|
writeWorldstate.guid = player->guid;
|
|
|
|
|
|
|
|
|
|
writeWorldstate.hour = -1;
|
|
|
|
|
writeWorldstate.month = -1;
|
|
|
|
|
writeWorldstate.day = day;
|
|
|
|
|
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
|
|
|
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate);
|
|
|
|
|
mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
|
|
|
|
}
|
|
|
|
|