Merge pull request #434 from TES3MP/0.6.3 while resolving conflicts

Conflicts:
	apps/openmw-mp/Networking.cpp
	apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp
	components/CMakeLists.txt
	components/openmw-mp/Base/BasePlayer.hpp
	components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp
sol2-server-rewrite
David Cernat 7 years ago
commit ad4214d3e2

@ -216,6 +216,8 @@ case $VS_VERSION in
15|15.0|2017 ) 15|15.0|2017 )
GENERATOR="Visual Studio 15 2017" GENERATOR="Visual Studio 15 2017"
TOOLSET="vc140" TOOLSET="vc140"
TOOLSET_REAL="vc141"
MSVC_REAL_VER="15"
MSVC_VER="14" MSVC_VER="14"
MSVC_YEAR="2015" MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2017" MSVC_DISPLAY_YEAR="2017"
@ -224,6 +226,8 @@ case $VS_VERSION in
14|14.0|2015 ) 14|14.0|2015 )
GENERATOR="Visual Studio 14 2015" GENERATOR="Visual Studio 14 2015"
TOOLSET="vc140" TOOLSET="vc140"
TOOLSET_REAL="vc140"
MSVC_REAL_VER="14"
MSVC_VER="14" MSVC_VER="14"
MSVC_YEAR="2015" MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2015" MSVC_DISPLAY_YEAR="2015"
@ -232,6 +236,8 @@ case $VS_VERSION in
12|12.0|2013 ) 12|12.0|2013 )
GENERATOR="Visual Studio 12 2013" GENERATOR="Visual Studio 12 2013"
TOOLSET="vc120" TOOLSET="vc120"
TOOLSET_REAL="vc120"
MSVC_REAL_VER="12"
MSVC_VER="12" MSVC_VER="12"
MSVC_YEAR="2013" MSVC_YEAR="2013"
MSVC_DISPLAY_YEAR="2013" MSVC_DISPLAY_YEAR="2013"
@ -385,7 +391,7 @@ else
if [ $MSVC_VER -eq 12 ]; then if [ $MSVC_VER -eq 12 ]; then
printf "Boost 1.58.0 AppVeyor... " printf "Boost 1.58.0 AppVeyor... "
else else
printf "Boost 1.60.0 AppVeyor... " printf "Boost 1.67.0 AppVeyor... "
fi fi
fi fi
{ {
@ -408,14 +414,20 @@ fi
echo Done. echo Done.
else else
# Appveyor unstable has all the boost we need already # Appveyor unstable has all the boost we need already
if [ $MSVC_VER -eq 12 ]; then if [ $MSVC_REAL_VER -eq 12 ]; then
BOOST_SDK="c:/Libraries/boost_1_58_0" BOOST_SDK="c:/Libraries/boost_1_58_0"
else else
BOOST_SDK="c:/Libraries/boost_1_60_0" BOOST_SDK="c:/Libraries/boost_1_67_0"
fi
if [ $MSVC_REAL_VER -eq 15 ]; then
LIB_SUFFIX="1"
else
LIB_SUFFIX="0"
fi fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.${LIB_SUFFIX}"
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" add_cmake_opts -DBoost_COMPILER="-${TOOLSET_REAL}"
echo Done. echo Done.
fi fi
@ -568,7 +580,7 @@ echo
if [ -z $APPVEYOR ]; then if [ -z $APPVEYOR ]; then
printf "Qt 5.7.0... " printf "Qt 5.7.0... "
else else
printf "Qt 5.7 AppVeyor... " printf "Qt 5.10 AppVeyor... "
fi fi
{ {
if [ $BITS -eq 64 ]; then if [ $BITS -eq 64 ]; then
@ -618,7 +630,7 @@ fi
echo Done. echo Done.
else else
QT_SDK="C:/Qt/5.7/msvc${MSVC_YEAR}${SUFFIX}" QT_SDK="C:/Qt/5.10/msvc${MSVC_DISPLAY_YEAR}${SUFFIX}"
add_cmake_opts -DDESIRED_QT_VERSION=5 \ add_cmake_opts -DDESIRED_QT_VERSION=5 \
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \

@ -105,7 +105,7 @@ namespace CSMWorld
{ ColumnId_Respawn, "Respawn" }, { ColumnId_Respawn, "Respawn" },
{ ColumnId_CreatureType, "Creature Type" }, { ColumnId_CreatureType, "Creature Type" },
{ ColumnId_SoulPoints, "Soul Points" }, { ColumnId_SoulPoints, "Soul Points" },
{ ColumnId_OriginalCreature, "Original Creature" }, { ColumnId_ParentCreature, "Parent Creature" },
{ ColumnId_Biped, "Biped" }, { ColumnId_Biped, "Biped" },
{ ColumnId_HasWeapon, "Has Weapon" }, { ColumnId_HasWeapon, "Has Weapon" },
{ ColumnId_Swims, "Swims" }, { ColumnId_Swims, "Swims" },

@ -99,7 +99,7 @@ namespace CSMWorld
ColumnId_Respawn = 84, ColumnId_Respawn = 84,
ColumnId_CreatureType = 85, ColumnId_CreatureType = 85,
ColumnId_SoulPoints = 86, ColumnId_SoulPoints = 86,
ColumnId_OriginalCreature = 87, ColumnId_ParentCreature = 87,
ColumnId_Biped = 88, ColumnId_Biped = 88,
ColumnId_HasWeapon = 89, ColumnId_HasWeapon = 89,
// unused // unused

@ -331,7 +331,7 @@ CSMWorld::RefIdCollection::RefIdCollection()
creatureColumns.mType = &mColumns.back(); creatureColumns.mType = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float)); mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float));
creatureColumns.mScale = &mColumns.back(); creatureColumns.mScale = &mColumns.back();
mColumns.push_back (RefIdColumn (Columns::ColumnId_OriginalCreature, ColumnBase::Display_Creature)); mColumns.push_back (RefIdColumn (Columns::ColumnId_ParentCreature, ColumnBase::Display_Creature));
creatureColumns.mOriginal = &mColumns.back(); creatureColumns.mOriginal = &mColumns.back();
static const struct static const struct

@ -51,6 +51,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer) : mclient(nullptr)
playerPacketController->SetStream(nullptr, &bsOut); playerPacketController->SetStream(nullptr, &bsOut);
actorPacketController->SetStream(nullptr, &bsOut); actorPacketController->SetStream(nullptr, &bsOut);
objectPacketController->SetStream(nullptr, &bsOut); objectPacketController->SetStream(nullptr, &bsOut);
worldstatePacketController->SetStream(nullptr, &bsOut);
running = true; running = true;
exitCode = 0; exitCode = 0;

@ -1,84 +0,0 @@
#include "Shapeshift.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Log.hpp>
#include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp>
#include <iostream>
using namespace std;
double ShapeshiftFunctions::GetScale(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0.0f);
return player->scale;
}
bool ShapeshiftFunctions::IsWerewolf(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->isWerewolf;
}
const char *ShapeshiftFunctions::GetCreatureRefId(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->creatureRefId.c_str();
}
bool ShapeshiftFunctions::GetCreatureNameDisplayState(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, 0);
return player->displayCreatureName;
}
void ShapeshiftFunctions::SetScale(unsigned short pid, double scale) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->scale = scale;
}
void ShapeshiftFunctions::SetWerewolfState(unsigned short pid, bool isWerewolf) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->isWerewolf = isWerewolf;
}
void ShapeshiftFunctions::SetCreatureRefId(unsigned short pid, const char *refId) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->creatureRefId = refId;
}
void ShapeshiftFunctions::SetCreatureNameDisplayState(unsigned short pid, bool displayState) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
player->displayCreatureName = displayState;
}
void ShapeshiftFunctions::SendShapeshift(unsigned short pid)
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->setPlayer(player);
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->Send(false);
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SHAPESHIFT)->Send(true);
}

@ -1,120 +0,0 @@
#ifndef OPENMW_SHAPESHIFTAPI_HPP
#define OPENMW_SHAPESHIFTAPI_HPP
#include "../Types.hpp"
#define SHAPESHIFTAPI \
{"GetScale", ShapeshiftFunctions::GetScale},\
{"IsWerewolf", ShapeshiftFunctions::IsWerewolf},\
{"GetCreatureRefId", ShapeshiftFunctions::GetCreatureRefId},\
{"GetCreatureNameDisplayState", ShapeshiftFunctions::GetCreatureNameDisplayState},\
\
{"SetScale", ShapeshiftFunctions::SetScale},\
{"SetWerewolfState", ShapeshiftFunctions::SetWerewolfState},\
{"SetCreatureRefId", ShapeshiftFunctions::SetCreatureRefId},\
{"SetCreatureNameDisplayState", ShapeshiftFunctions::SetCreatureNameDisplayState},\
\
{"SendShapeshift", ShapeshiftFunctions::SendShapeshift}
class ShapeshiftFunctions
{
public:
/**
* \brief Get the scale of a player.
*
* \param pid The player ID.
* \return The scale.
*/
static double GetScale(unsigned short pid) noexcept;
/**
* \brief Check whether a player is a werewolf.
*
* This is based on the last PlayerShapeshift packet received or sent for that player.
*
* \param pid The player ID.
* \return The werewolf state.
*/
static bool IsWerewolf(unsigned short pid) noexcept;
/**
* \brief Get the refId of the creature the player is disguised as.
*
* \param pid The player ID.
* \return The creature refId.
*/
static const char *GetCreatureRefId(unsigned short pid) noexcept;
/**
* \brief Check whether a player's name is replaced by that of the creature they are
* disguised as when other players hover over them.
*
* This is based on the last PlayerShapeshift packet received or sent for that player.
*
* \param pid The player ID.
* \return The creature name display state.
*/
static bool GetCreatureNameDisplayState(unsigned short pid) noexcept;
/**
* \brief Set the scale of a player.
*
* This changes the scale recorded for that player in the server memory, but
* does not by itself send a packet.
*
* \param pid The player ID.
* \param scale The new scale.
* \return void
*/
static void SetScale(unsigned short pid, double scale) noexcept;
/**
* \brief Set the werewolf state of a player.
*
* This changes the werewolf state recorded for that player in the server memory, but
* does not by itself send a packet.
*
* \param pid The player ID.
* \param isWerewolf The new werewolf state.
* \return void
*/
static void SetWerewolfState(unsigned short pid, bool isWerewolf) noexcept;
/**
* \brief Set the refId of the creature a player is disguised as.
*
* This changes the creature refId recorded for that player in the server memory, but
* does not by itself send a packet.
*
* \param pid The player ID.
* \param refId The creature refId.
* \param displaysCreatureName Whether the player's name appears as that of the creature
* when hovered over by others.
* \return void
*/
static void SetCreatureRefId(unsigned short pid, const char *refId) noexcept;
/**
* \brief Set whether a player's name is replaced by that of the creature they are
* disguised as when other players hover over them.
*
* \param pid The player ID.
* \param displayState The creature name display state.
* \return void
*/
static void SetCreatureNameDisplayState(unsigned short pid, bool displayState) noexcept;
/**
* \brief Send a PlayerShapeshift packet about a player.
*
* This sends the packet to all players connected to the server. It is currently used
* only to communicate werewolf states.
*
* \param pid The player ID.
* \return void
*/
static void SendShapeshift(unsigned short pid);
};
#endif //OPENMW_SHAPESHIFTAPI_HPP

@ -1,50 +0,0 @@
#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);
}

@ -1,44 +0,0 @@
#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

@ -12,8 +12,10 @@
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Version.hpp> #include <components/openmw-mp/Version.hpp>
#include <components/openmw-mp/Base/BaseWorldstate.hpp>
#include <apps/openmw/mwworld/inventorystore.hpp> #include <apps/openmw/mwworld/inventorystore.hpp>
@ -37,6 +39,7 @@
using namespace std; using namespace std;
mwmp::BaseWorldstate tempWorldstate;
#if defined(SOL_SAFE_FUNCTIONS) #if defined(SOL_SAFE_FUNCTIONS)
inline int errHandler(lua_State *L) inline int errHandler(lua_State *L)
@ -258,38 +261,47 @@ LuaState::LuaState()
}); });
lua->set_function("setHour", [](double hour) { lua->set_function("setHour", [](double hour) {
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME);
tempWorldstate.hour = hour;
tempWorldstate.month = -1;
tempWorldstate.day = -1;
Players::for_each([&hour, &packet](Player *player){ Players::for_each([&hour, &packet](Player *player){
player->hour = hour;
player->month = -1;
player->day = -1;
packet->setPlayer(player); tempWorldstate.guid = player->guid;
packet->setWorldstate(&tempWorldstate);
packet->Send(false); packet->Send(false);
}); });
}); });
lua->set_function("setMonth", [](int month) { lua->set_function("setMonth", [](int month) {
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME);
tempWorldstate.hour = -1;
tempWorldstate.month = month;
tempWorldstate.day = -1;
Players::for_each([&month, &packet](Player *player){ Players::for_each([&month, &packet](Player *player){
player->hour = -1;
player->month = month;
player->day = -1;
packet->setPlayer(player); tempWorldstate.guid = player->guid;
packet->setWorldstate(&tempWorldstate);
packet->Send(false); packet->Send(false);
}); });
}); });
lua->set_function("setDay", [](int day) { lua->set_function("setDay", [](int day) {
auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME);
tempWorldstate.hour = -1;
tempWorldstate.month = -1;
tempWorldstate.day = day;
Players::for_each([&day, &packet](Player *player){ Players::for_each([&day, &packet](Player *player){
player->hour = -1;
player->month = -1;
player->day = day;
packet->setPlayer(player); tempWorldstate.guid = player->guid;
packet->setWorldstate(&tempWorldstate);
packet->Send(false); packet->Send(false);
}); });
}); });

@ -115,14 +115,14 @@ add_openmw_dir (mwmp/processors/actor ProcessorActorAI ProcessorActorAnimFlags P
add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorHandshake add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorHandshake
ProcessorUserDisconnected ProcessorUserMyID ProcessorCellCreate ProcessorRecordDynamic ProcessorGameSettings ProcessorUserDisconnected ProcessorUserMyID ProcessorCellCreate ProcessorRecordDynamic ProcessorGameSettings
ProcessorGameTime ProcessorGameWeather ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorGameWeather ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute
ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange
ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition
ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInteraction ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInteraction ProcessorPlayerInventory ProcessorPlayerJail
ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMap ProcessorPlayerMiscellaneous
ProcessorPlayerMap ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect
ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic
ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic ProcessorPlayerTopic
) )
add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleCommand ProcessorContainer ProcessorDoorDestination add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleCommand ProcessorContainer ProcessorDoorDestination
@ -133,6 +133,9 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor ProcessorConsoleComma
ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat ProcessorScriptMemberFloat ProcessorScriptGlobalShort ProcessorScriptGlobalFloat
) )
add_openmw_dir (mwmp/processors/worldstate ProcessorGameTime
)
# Main executable # Main executable
if (NOT ANDROID) if (NOT ANDROID)

@ -1,7 +1,8 @@
#include "ObjectProcessor.hpp"
#include "../Main.hpp" #include "../Main.hpp"
#include "../Networking.hpp" #include "../Networking.hpp"
#include "ObjectProcessor.hpp"
using namespace mwmp; using namespace mwmp;
template<class T> template<class T>

@ -9,7 +9,6 @@
#include "player/ProcessorCellCreate.hpp" #include "player/ProcessorCellCreate.hpp"
#include "player/ProcessorRecordDynamic.hpp" #include "player/ProcessorRecordDynamic.hpp"
#include "player/ProcessorGameSettings.hpp" #include "player/ProcessorGameSettings.hpp"
#include "player/ProcessorGameTime.hpp"
#include "player/ProcessorGameWeather.hpp" #include "player/ProcessorGameWeather.hpp"
#include "player/ProcessorPlayerAnimFlags.hpp" #include "player/ProcessorPlayerAnimFlags.hpp"
#include "player/ProcessorPlayerAnimPlay.hpp" #include "player/ProcessorPlayerAnimPlay.hpp"
@ -93,6 +92,7 @@
#include "actor/ProcessorActorTest.hpp" #include "actor/ProcessorActorTest.hpp"
#include "WorldstateProcessor.hpp" #include "WorldstateProcessor.hpp"
#include "worldstate/ProcessorGameTime.hpp"
using namespace mwmp; using namespace mwmp;
@ -106,7 +106,6 @@ void ProcessorInitializer()
PlayerProcessor::AddProcessor(new ProcessorCellCreate()); PlayerProcessor::AddProcessor(new ProcessorCellCreate());
PlayerProcessor::AddProcessor(new ProcessorRecordDynamic()); PlayerProcessor::AddProcessor(new ProcessorRecordDynamic());
PlayerProcessor::AddProcessor(new ProcessorGameSettings()); PlayerProcessor::AddProcessor(new ProcessorGameSettings());
PlayerProcessor::AddProcessor(new ProcessorGameTime());
PlayerProcessor::AddProcessor(new ProcessorGameWeather()); PlayerProcessor::AddProcessor(new ProcessorGameWeather());
PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags());
PlayerProcessor::AddProcessor(new ProcessorPlayerAnimPlay()); PlayerProcessor::AddProcessor(new ProcessorPlayerAnimPlay());
@ -186,4 +185,6 @@ void ProcessorInitializer()
ActorProcessor::AddProcessor(new ProcessorActorSpeech()); ActorProcessor::AddProcessor(new ProcessorActorSpeech());
ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic());
ActorProcessor::AddProcessor(new ProcessorActorTest()); ActorProcessor::AddProcessor(new ProcessorActorTest());
WorldstateProcessor::AddProcessor(new ProcessorGameTime());
} }

@ -1,6 +1,7 @@
#include "../Main.hpp"
#include "../Networking.hpp" #include "../Networking.hpp"
#include "WorldstateProcessor.hpp" #include "WorldstateProcessor.hpp"
#include "../Main.hpp"
using namespace mwmp; using namespace mwmp;
@ -14,6 +15,8 @@ bool WorldstateProcessor::Process(RakNet::Packet &packet, BaseWorldstate &worlds
worldstate.guid = guid; worldstate.guid = guid;
WorldstatePacket *myPacket = Main::get().getNetworking()->getWorldstatePacket(packet.data[0]); WorldstatePacket *myPacket = Main::get().getNetworking()->getWorldstatePacket(packet.data[0]);
myPacket->setWorldstate(&worldstate);
myPacket->SetReadStream(&bsIn); myPacket->SetReadStream(&bsIn);
for (auto &processor : processors) for (auto &processor : processors)

@ -1,18 +1,14 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORGAMETIME_HPP #ifndef OPENMW_PROCESSORGAMETIME_HPP
#define OPENMW_PROCESSORGAMETIME_HPP #define OPENMW_PROCESSORGAMETIME_HPP
#include <apps/openmw/mwbase/world.hpp> #include <apps/openmw/mwbase/world.hpp>
#include <apps/openmw/mwbase/environment.hpp> #include <apps/openmw/mwbase/environment.hpp>
#include "../PlayerProcessor.hpp" #include "../WorldstateProcessor.hpp"
namespace mwmp namespace mwmp
{ {
class ProcessorGameTime final: public PlayerProcessor class ProcessorGameTime final : public WorldstateProcessor
{ {
public: public:
ProcessorGameTime() ProcessorGameTime()
@ -20,17 +16,17 @@ namespace mwmp
BPP_INIT(ID_GAME_TIME) BPP_INIT(ID_GAME_TIME)
} }
virtual void Do(PlayerPacket &packet, BasePlayer *player) virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate)
{ {
if (isLocal()) if (isLocal())
{ {
MWBase::World *world = MWBase::Environment::get().getWorld(); MWBase::World *world = MWBase::Environment::get().getWorld();
if (player->hour != -1) if (worldstate.hour != -1)
world->setHour(player->hour); world->setHour(worldstate.hour);
else if (player->day != -1) else if (worldstate.day != -1)
world->setDay(player->day); world->setDay(worldstate.day);
else if (player->month != -1) else if (worldstate.month != -1)
world->setMonth(player->month); world->setMonth(worldstate.month);
} }
} }
}; };

@ -8,35 +8,31 @@ branches:
environment: environment:
matrix: matrix:
- msvc: 2013
- msvc: 2015 - msvc: 2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- msvc: 2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
platform: platform:
- Win32 # - Win32
# - x64 - x64
configuration: configuration:
- Debug - Debug
# - Release # - Release
# For the Qt, Boost, CMake, etc installs # For the Qt, Boost, CMake, etc installs
os: Visual Studio 2015 #os: Visual Studio 2017
# We want the git revision for versioning, # We want the git revision for versioning,
# so shallow clones don't work. # so shallow clones don't work.
clone_depth: 1 clone_depth: 1
cache: cache:
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2013-win32.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2013-win64.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win32.7z - C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win32.7z
- C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win64.7z - C:\projects\openmw\deps\Bullet-2.83.7-msvc2015-win64.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2013-win32.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2013-win32.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z - C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z
- C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z - C:\projects\openmw\deps\MyGUI-3.2.3-git-msvc2015-win64.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2013-win32.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2013-win32.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z - C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z
- C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z - C:\projects\openmw\deps\OSG-3.4.0-scrawl-msvc2015-win64.7z
- C:\projects\openmw\deps\ffmpeg-3.0.1-dev-win32.7z - C:\projects\openmw\deps\ffmpeg-3.0.1-dev-win32.7z
@ -52,7 +48,7 @@ install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH% - set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
before_build: before_build:
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc% - cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc% -V
build_script: build_script:
- cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32 - cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32

@ -174,8 +174,7 @@ add_component_dir (openmw-mp/Packets/Actor
add_component_dir (openmw-mp/Packets/Player add_component_dir (openmw-mp/Packets/Player
PlayerPacket PlayerPacket
PacketHandshake PacketChatMessage PacketGUIBoxes PacketGUIWindow PacketGameSettings PacketGameTime PacketHandshake PacketChatMessage PacketGUIBoxes PacketGUIWindow PacketGameSettings PacketGameWeather
PacketGameWeather
PacketCellCreate PacketRecordDynamic PacketCellCreate PacketRecordDynamic
@ -199,6 +198,7 @@ add_component_dir (openmw-mp/Packets/Object
add_component_dir (openmw-mp/Packets/Worldstate add_component_dir (openmw-mp/Packets/Worldstate
WorldstatePacket WorldstatePacket
PacketGameTime
) )
add_component_dir (fallback add_component_dir (fallback

@ -281,10 +281,7 @@ namespace mwmp
RakNet::RakNetGUID guid; RakNet::RakNetGUID guid;
GUIMessageBox guiMessageBox; GUIMessageBox guiMessageBox;
int month;
int day;
GUIWindow guiWindow; GUIWindow guiWindow;
double hour;
// Track only the indexes of the attributes that have been changed, // Track only the indexes of the attributes that have been changed,
// with the attribute values themselves being stored in creatureStats.mAttributes // with the attribute values themselves being stored in creatureStats.mAttributes

@ -1,6 +1,8 @@
#ifndef OPENMW_BASESTRUCTS_HPP #ifndef OPENMW_BASESTRUCTS_HPP
#define OPENMW_BASESTRUCTS_HPP #define OPENMW_BASESTRUCTS_HPP
#include <string>
#include <components/esm/statstate.hpp> #include <components/esm/statstate.hpp>
#include <vector> #include <vector>

@ -19,6 +19,10 @@ namespace mwmp
RakNet::RakNetGUID guid; RakNet::RakNetGUID guid;
int month;
int day;
double hour;
bool isValid; bool isValid;
}; };
} }

@ -8,7 +8,6 @@
#include "../Packets/Player/PacketCellCreate.hpp" #include "../Packets/Player/PacketCellCreate.hpp"
#include "../Packets/Player/PacketRecordDynamic.hpp" #include "../Packets/Player/PacketRecordDynamic.hpp"
#include "../Packets/Player/PacketGameSettings.hpp" #include "../Packets/Player/PacketGameSettings.hpp"
#include "../Packets/Player/PacketGameTime.hpp"
#include "../Packets/Player/PacketGameWeather.hpp" #include "../Packets/Player/PacketGameWeather.hpp"
#include "../Packets/Player/PacketPlayerActiveSkills.hpp" #include "../Packets/Player/PacketPlayerActiveSkills.hpp"
#include "../Packets/Player/PacketPlayerAnimFlags.hpp" #include "../Packets/Player/PacketPlayerAnimFlags.hpp"
@ -60,7 +59,6 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
AddPacket<PacketCellCreate>(&packets, peer); AddPacket<PacketCellCreate>(&packets, peer);
AddPacket<PacketRecordDynamic>(&packets, peer); AddPacket<PacketRecordDynamic>(&packets, peer);
AddPacket<PacketGameSettings>(&packets, peer); AddPacket<PacketGameSettings>(&packets, peer);
AddPacket<PacketGameTime>(&packets, peer);
AddPacket<PacketGameWeather>(&packets, peer); AddPacket<PacketGameWeather>(&packets, peer);
AddPacket<PacketPlayerActiveSkills>(&packets, peer); AddPacket<PacketPlayerActiveSkills>(&packets, peer);

@ -1,6 +1,8 @@
#include "../Packets/Worldstate/PacketGameTime.hpp"
#include "WorldstatePacketController.hpp" #include "WorldstatePacketController.hpp"
mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer) mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer)
{ {
AddPacket<PacketGameTime>(&packets, peer);
} }

@ -1,13 +1,9 @@
//
// Created by koncord on 30.08.16.
//
#include "PacketGameTime.hpp" #include "PacketGameTime.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp; using namespace mwmp;
PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
{ {
packetID = ID_GAME_TIME; packetID = ID_GAME_TIME;
orderChannel = CHANNEL_SYSTEM; orderChannel = CHANNEL_SYSTEM;
@ -15,9 +11,9 @@ PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : PlayerPacket(pe
void PacketGameTime::Packet(RakNet::BitStream *bs, bool send) void PacketGameTime::Packet(RakNet::BitStream *bs, bool send)
{ {
PlayerPacket::Packet(bs, send); WorldstatePacket::Packet(bs, send);
RW(player->month, send); RW(worldstate->month, send);
RW(player->day, send); RW(worldstate->day, send);
RW(player->hour, send); RW(worldstate->hour, send);
} }

@ -1,15 +1,11 @@
//
// Created by koncord on 30.08.16.
//
#ifndef OPENMW_PACKETGAMETIME_HPP #ifndef OPENMW_PACKETGAMETIME_HPP
#define OPENMW_PACKETGAMETIME_HPP #define OPENMW_PACKETGAMETIME_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp> #include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
namespace mwmp namespace mwmp
{ {
class PacketGameTime final: public PlayerPacket class PacketGameTime final : public WorldstatePacket
{ {
public: public:
PacketGameTime(RakNet::RakPeerInterface *peer); PacketGameTime(RakNet::RakPeerInterface *peer);
Loading…
Cancel
Save