|
|
|
@ -1,7 +1,11 @@
|
|
|
|
|
#ifndef OPENMW_PROCESSORGAMEWEATHER_HPP
|
|
|
|
|
#define OPENMW_PROCESSORGAMEWEATHER_HPP
|
|
|
|
|
|
|
|
|
|
#include <apps/openmw/mwworld/worldimp.hpp>
|
|
|
|
|
#include <apps/openmw/mwworld/weather.hpp>
|
|
|
|
|
#include "../PlayerProcessor.hpp"
|
|
|
|
|
#include <apps/openmw/mwmp/Main.hpp>
|
|
|
|
|
#include <apps/openmw/mwmp/Networking.hpp>
|
|
|
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
|
{
|
|
|
|
@ -15,7 +19,27 @@ namespace mwmp
|
|
|
|
|
|
|
|
|
|
void Do(PlayerPacket &packet, BasePlayer *player) final
|
|
|
|
|
{
|
|
|
|
|
// Placeholder to be filled in later
|
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID);
|
|
|
|
|
MWWorld::WeatherManager *weatherManager = Main::get().getWeatherManager();
|
|
|
|
|
auto &weather = player->weather;
|
|
|
|
|
if(isRequest())
|
|
|
|
|
{
|
|
|
|
|
LOG_APPEND(Log::LOG_TRACE, "- requested data");
|
|
|
|
|
weather.currentWeather = weatherManager->mCurrentWeather;
|
|
|
|
|
weather.nextWeather = weatherManager->mNextWeather;
|
|
|
|
|
weather.transitionFactor = weatherManager->mTransitionFactor;
|
|
|
|
|
weather.updateTime = weatherManager->mWeatherUpdateTime;
|
|
|
|
|
packet.setPlayer(player);
|
|
|
|
|
packet.Send();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LOG_APPEND(Log::LOG_TRACE, "- received data");
|
|
|
|
|
weatherManager->mCurrentWeather = weather.currentWeather;
|
|
|
|
|
weatherManager->mNextWeather = weather.nextWeather;
|
|
|
|
|
weatherManager->mTransitionFactor = weather.transitionFactor;
|
|
|
|
|
weatherManager->mWeatherUpdateTime = weather.updateTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|