Merge branch 'master' of https://github.com/TES3MP/openmw-tes3mp
commit
f562215d9a
@ -0,0 +1,46 @@
|
||||
//
|
||||
// Created by koncord on 30.08.16.
|
||||
//
|
||||
|
||||
#include <apps/openmw-mp/Player.hpp>
|
||||
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
||||
#include <apps/openmw-mp/Networking.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "World.hpp"
|
||||
|
||||
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->hour = hour;
|
||||
player->month = -1;
|
||||
player->day = -1;
|
||||
|
||||
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false);
|
||||
}
|
||||
|
||||
void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->hour = -1;
|
||||
player->month = month;
|
||||
player->day = -1;
|
||||
|
||||
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false);
|
||||
|
||||
}
|
||||
|
||||
void WorldFunctions::SetDay(unsigned short pid, int day) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
player->hour = -1;
|
||||
player->month = -1;
|
||||
player->day = day;
|
||||
|
||||
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by koncord on 30.08.16.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_WORLD_HPP
|
||||
#define OPENMW_WORLD_HPP
|
||||
|
||||
#define WORLDFUNCTIONS \
|
||||
{"SetHour", WorldFunctions::SetHour},\
|
||||
{"SetMonth", WorldFunctions::SetMonth},\
|
||||
{"SetDay", WorldFunctions::SetDay}
|
||||
|
||||
class WorldFunctions
|
||||
{
|
||||
public:
|
||||
static void SetHour(unsigned short pid, double hour) noexcept;
|
||||
static void SetMonth(unsigned short pid, int month) noexcept;
|
||||
static void SetDay(unsigned short pid, int day) noexcept;
|
||||
};
|
||||
|
||||
|
||||
#endif //OPENMW_WORLD_HPP
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by koncord on 30.08.16.
|
||||
//
|
||||
|
||||
#include "PacketTime.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
||||
{
|
||||
packetID = ID_GAME_TIME;
|
||||
}
|
||||
|
||||
void PacketTime::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||
{
|
||||
BasePacket::Packet(bs, player, send);
|
||||
|
||||
RW(player->month, send);
|
||||
RW(player->day, send);
|
||||
RW(player->hour, send);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by koncord on 30.08.16.
|
||||
//
|
||||
|
||||
#ifndef OPENMW_TIMEPACKET_HPP
|
||||
#define OPENMW_TIMEPACKET_HPP
|
||||
|
||||
|
||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketTime : public BasePacket
|
||||
{
|
||||
public:
|
||||
const static int StatsCount = 27;
|
||||
PacketTime(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //OPENMW_TIMEPACKET_HPP
|
Loading…
Reference in New Issue