Merge pull request #427 from TES3MP/0.6.3 while resolving conflicts
Conflicts: apps/openmw-mp/CMakeLists.txt apps/openmw-mp/Script/Functions/Objects.cpp apps/openmw-mp/Script/Functions/Objects.hpp apps/openmw-mp/Script/ScriptFunctions.hpppull/417/merge
commit
98eece808b
@ -0,0 +1,50 @@
|
|||||||
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
|
||||||
|
#include <apps/openmw-mp/Networking.hpp>
|
||||||
|
#include <apps/openmw-mp/Player.hpp>
|
||||||
|
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
|
||||||
|
|
||||||
|
#include "Worldstate.hpp"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void WorldstateFunctions::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().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldstateFunctions::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().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldstateFunctions::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().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
#ifndef OPENMW_WORLDSTATEAPI_HPP
|
||||||
|
#define OPENMW_WORLDSTATEAPI_HPP
|
||||||
|
|
||||||
|
#include "../Types.hpp"
|
||||||
|
|
||||||
|
#define WORLDSTATEAPI \
|
||||||
|
{"SetHour", WorldstateFunctions::SetHour},\
|
||||||
|
{"SetMonth", WorldstateFunctions::SetMonth},\
|
||||||
|
{"SetDay", WorldstateFunctions::SetDay}
|
||||||
|
|
||||||
|
class WorldstateFunctions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the game hour for a player and send a GameTime packet to that player.
|
||||||
|
*
|
||||||
|
* \param pid The player ID.
|
||||||
|
* \param hour The hour.
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SetHour(unsigned short pid, double hour) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the game month for a player and send a GameTime packet to that player.
|
||||||
|
*
|
||||||
|
* \param pid The player ID.
|
||||||
|
* \param month The month.
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SetMonth(unsigned short pid, int month) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the game day for a player and send a GameTime packet to that player.
|
||||||
|
*
|
||||||
|
* \param pid The player ID.
|
||||||
|
* \param day The day.
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void SetDay(unsigned short pid, int day) noexcept;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //OPENMW_WORLDSTATEAPI_HPP
|
Loading…
Reference in New Issue