diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index a0cf06919..9c12c45db 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -216,6 +216,8 @@ case $VS_VERSION in 15|15.0|2017 ) GENERATOR="Visual Studio 15 2017" TOOLSET="vc140" + TOOLSET_REAL="vc141" + MSVC_REAL_VER="15" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2017" @@ -224,6 +226,8 @@ case $VS_VERSION in 14|14.0|2015 ) GENERATOR="Visual Studio 14 2015" TOOLSET="vc140" + TOOLSET_REAL="vc140" + MSVC_REAL_VER="14" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2015" @@ -232,6 +236,8 @@ case $VS_VERSION in 12|12.0|2013 ) GENERATOR="Visual Studio 12 2013" TOOLSET="vc120" + TOOLSET_REAL="vc120" + MSVC_REAL_VER="12" MSVC_VER="12" MSVC_YEAR="2013" MSVC_DISPLAY_YEAR="2013" @@ -385,7 +391,7 @@ else if [ $MSVC_VER -eq 12 ]; then printf "Boost 1.58.0 AppVeyor... " else - printf "Boost 1.60.0 AppVeyor... " + printf "Boost 1.67.0 AppVeyor... " fi fi { @@ -408,14 +414,20 @@ fi echo Done. else # 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" 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 + add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ - -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" - add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" + -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.${LIB_SUFFIX}" + add_cmake_opts -DBoost_COMPILER="-${TOOLSET_REAL}" echo Done. fi @@ -568,7 +580,7 @@ echo if [ -z $APPVEYOR ]; then printf "Qt 5.7.0... " else - printf "Qt 5.7 AppVeyor... " + printf "Qt 5.10 AppVeyor... " fi { if [ $BITS -eq 64 ]; then @@ -618,7 +630,7 @@ fi echo Done. 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 \ -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ diff --git a/apps/opencs/model/world/columns.cpp b/apps/opencs/model/world/columns.cpp index 7c0fbff4b..109708ab0 100644 --- a/apps/opencs/model/world/columns.cpp +++ b/apps/opencs/model/world/columns.cpp @@ -105,7 +105,7 @@ namespace CSMWorld { ColumnId_Respawn, "Respawn" }, { ColumnId_CreatureType, "Creature Type" }, { ColumnId_SoulPoints, "Soul Points" }, - { ColumnId_OriginalCreature, "Original Creature" }, + { ColumnId_ParentCreature, "Parent Creature" }, { ColumnId_Biped, "Biped" }, { ColumnId_HasWeapon, "Has Weapon" }, { ColumnId_Swims, "Swims" }, diff --git a/apps/opencs/model/world/columns.hpp b/apps/opencs/model/world/columns.hpp index 15018795c..f9ba5725a 100644 --- a/apps/opencs/model/world/columns.hpp +++ b/apps/opencs/model/world/columns.hpp @@ -99,7 +99,7 @@ namespace CSMWorld ColumnId_Respawn = 84, ColumnId_CreatureType = 85, ColumnId_SoulPoints = 86, - ColumnId_OriginalCreature = 87, + ColumnId_ParentCreature = 87, ColumnId_Biped = 88, ColumnId_HasWeapon = 89, // unused diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index 44a6ce07d..60a513cb6 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -331,7 +331,7 @@ CSMWorld::RefIdCollection::RefIdCollection() creatureColumns.mType = &mColumns.back(); mColumns.push_back (RefIdColumn (Columns::ColumnId_Scale, ColumnBase::Display_Float)); 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(); static const struct diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index d202e2b10..e771fdc64 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -51,6 +51,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer) : mclient(nullptr) playerPacketController->SetStream(nullptr, &bsOut); actorPacketController->SetStream(nullptr, &bsOut); objectPacketController->SetStream(nullptr, &bsOut); + worldstatePacketController->SetStream(nullptr, &bsOut); running = true; exitCode = 0; diff --git a/apps/openmw-mp/Script/Functions/Shapeshift.cpp b/apps/openmw-mp/Script/Functions/Shapeshift.cpp deleted file mode 100644 index 2ac33c701..000000000 --- a/apps/openmw-mp/Script/Functions/Shapeshift.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "Shapeshift.hpp" - -#include -#include - -#include -#include - -#include -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); -} diff --git a/apps/openmw-mp/Script/Functions/Shapeshift.hpp b/apps/openmw-mp/Script/Functions/Shapeshift.hpp deleted file mode 100644 index 4d211185e..000000000 --- a/apps/openmw-mp/Script/Functions/Shapeshift.hpp +++ /dev/null @@ -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 diff --git a/apps/openmw-mp/Script/Functions/Worldstate.cpp b/apps/openmw-mp/Script/Functions/Worldstate.cpp deleted file mode 100644 index b95b67d14..000000000 --- a/apps/openmw-mp/Script/Functions/Worldstate.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include - -#include -#include -#include - -#include "Worldstate.hpp" - -#include -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); -} diff --git a/apps/openmw-mp/Script/Functions/Worldstate.hpp b/apps/openmw-mp/Script/Functions/Worldstate.hpp deleted file mode 100644 index 5a1f6ee8a..000000000 --- a/apps/openmw-mp/Script/Functions/Worldstate.hpp +++ /dev/null @@ -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 diff --git a/apps/openmw-mp/Script/LuaState.cpp b/apps/openmw-mp/Script/LuaState.cpp index 8f3d7e116..da253573a 100644 --- a/apps/openmw-mp/Script/LuaState.cpp +++ b/apps/openmw-mp/Script/LuaState.cpp @@ -12,8 +12,10 @@ #include #include + #include #include +#include #include @@ -37,6 +39,7 @@ using namespace std; +mwmp::BaseWorldstate tempWorldstate; #if defined(SOL_SAFE_FUNCTIONS) inline int errHandler(lua_State *L) @@ -258,38 +261,47 @@ LuaState::LuaState() }); lua->set_function("setHour", [](double hour) { - auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&hour, &packet](Player *player){ - player->hour = hour; - player->month = -1; - player->day = -1; + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); - packet->setPlayer(player); + tempWorldstate.hour = hour; + tempWorldstate.month = -1; + tempWorldstate.day = -1; + + Players::for_each([&hour, &packet](Player *player){ + + tempWorldstate.guid = player->guid; + packet->setWorldstate(&tempWorldstate); packet->Send(false); }); }); lua->set_function("setMonth", [](int month) { - auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&month, &packet](Player *player){ - player->hour = -1; - player->month = month; - player->day = -1; + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); - packet->setPlayer(player); + tempWorldstate.hour = -1; + tempWorldstate.month = month; + tempWorldstate.day = -1; + + Players::for_each([&month, &packet](Player *player){ + + tempWorldstate.guid = player->guid; + packet->setWorldstate(&tempWorldstate); packet->Send(false); }); }); lua->set_function("setDay", [](int day) { - auto packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME); - Players::for_each([&day, &packet](Player *player){ - player->hour = -1; - player->month = -1; - player->day = day; + auto packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME); - packet->setPlayer(player); + tempWorldstate.hour = -1; + tempWorldstate.month = -1; + tempWorldstate.day = day; + + Players::for_each([&day, &packet](Player *player){ + + tempWorldstate.guid = player->guid; + packet->setWorldstate(&tempWorldstate); packet->Send(false); }); }); diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index b0d0be615..1f5251f43 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -115,14 +115,14 @@ add_openmw_dir (mwmp/processors/actor ProcessorActorAI ProcessorActorAnimFlags P add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorHandshake ProcessorUserDisconnected ProcessorUserMyID ProcessorCellCreate ProcessorRecordDynamic ProcessorGameSettings - ProcessorGameTime ProcessorGameWeather ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack - ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty - ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath - ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInteraction - ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel - ProcessorPlayerMap ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys - ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech - ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic + ProcessorGameWeather ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute + ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange + ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition + ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInteraction ProcessorPlayerInventory ProcessorPlayerJail + ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMap ProcessorPlayerMiscellaneous + ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect + ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic + ProcessorPlayerTopic ) 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 ) +add_openmw_dir (mwmp/processors/worldstate ProcessorGameTime + ) + # Main executable if (NOT ANDROID) diff --git a/apps/openmw/mwmp/processors/ObjectProcessor.cpp b/apps/openmw/mwmp/processors/ObjectProcessor.cpp index 7eae403db..33cce8352 100644 --- a/apps/openmw/mwmp/processors/ObjectProcessor.cpp +++ b/apps/openmw/mwmp/processors/ObjectProcessor.cpp @@ -1,7 +1,8 @@ -#include "ObjectProcessor.hpp" #include "../Main.hpp" #include "../Networking.hpp" +#include "ObjectProcessor.hpp" + using namespace mwmp; template diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index 2e5401fdf..e9f1f5f0c 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -9,7 +9,6 @@ #include "player/ProcessorCellCreate.hpp" #include "player/ProcessorRecordDynamic.hpp" #include "player/ProcessorGameSettings.hpp" -#include "player/ProcessorGameTime.hpp" #include "player/ProcessorGameWeather.hpp" #include "player/ProcessorPlayerAnimFlags.hpp" #include "player/ProcessorPlayerAnimPlay.hpp" @@ -93,6 +92,7 @@ #include "actor/ProcessorActorTest.hpp" #include "WorldstateProcessor.hpp" +#include "worldstate/ProcessorGameTime.hpp" using namespace mwmp; @@ -106,7 +106,6 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorCellCreate()); PlayerProcessor::AddProcessor(new ProcessorRecordDynamic()); PlayerProcessor::AddProcessor(new ProcessorGameSettings()); - PlayerProcessor::AddProcessor(new ProcessorGameTime()); PlayerProcessor::AddProcessor(new ProcessorGameWeather()); PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); PlayerProcessor::AddProcessor(new ProcessorPlayerAnimPlay()); @@ -186,4 +185,6 @@ void ProcessorInitializer() ActorProcessor::AddProcessor(new ProcessorActorSpeech()); ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorTest()); + + WorldstateProcessor::AddProcessor(new ProcessorGameTime()); } diff --git a/apps/openmw/mwmp/processors/WorldstateProcessor.cpp b/apps/openmw/mwmp/processors/WorldstateProcessor.cpp index 684e7d355..693241ace 100644 --- a/apps/openmw/mwmp/processors/WorldstateProcessor.cpp +++ b/apps/openmw/mwmp/processors/WorldstateProcessor.cpp @@ -1,6 +1,7 @@ -#include "../Networking.hpp" -#include "WorldstateProcessor.hpp" #include "../Main.hpp" +#include "../Networking.hpp" + +#include "WorldstateProcessor.hpp" using namespace mwmp; @@ -14,6 +15,8 @@ bool WorldstateProcessor::Process(RakNet::Packet &packet, BaseWorldstate &worlds worldstate.guid = guid; WorldstatePacket *myPacket = Main::get().getNetworking()->getWorldstatePacket(packet.data[0]); + + myPacket->setWorldstate(&worldstate); myPacket->SetReadStream(&bsIn); for (auto &processor : processors) diff --git a/apps/openmw/mwmp/processors/player/ProcessorGameTime.hpp b/apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp similarity index 50% rename from apps/openmw/mwmp/processors/player/ProcessorGameTime.hpp rename to apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp index 863965f72..f7730d8a7 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorGameTime.hpp +++ b/apps/openmw/mwmp/processors/worldstate/ProcessorGameTime.hpp @@ -1,18 +1,14 @@ -// -// Created by koncord on 16.04.17. -// - #ifndef OPENMW_PROCESSORGAMETIME_HPP #define OPENMW_PROCESSORGAMETIME_HPP #include #include -#include "../PlayerProcessor.hpp" +#include "../WorldstateProcessor.hpp" namespace mwmp { - class ProcessorGameTime final: public PlayerProcessor + class ProcessorGameTime final : public WorldstateProcessor { public: ProcessorGameTime() @@ -20,17 +16,17 @@ namespace mwmp BPP_INIT(ID_GAME_TIME) } - virtual void Do(PlayerPacket &packet, BasePlayer *player) + virtual void Do(WorldstatePacket &packet, BaseWorldstate &worldstate) { if (isLocal()) { MWBase::World *world = MWBase::Environment::get().getWorld(); - if (player->hour != -1) - world->setHour(player->hour); - else if (player->day != -1) - world->setDay(player->day); - else if (player->month != -1) - world->setMonth(player->month); + if (worldstate.hour != -1) + world->setHour(worldstate.hour); + else if (worldstate.day != -1) + world->setDay(worldstate.day); + else if (worldstate.month != -1) + world->setMonth(worldstate.month); } } }; diff --git a/appveyor.yml b/appveyor.yml index d8f2bfc35..eae4bd5b1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,35 +8,31 @@ branches: environment: matrix: - - msvc: 2013 - msvc: 2015 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - msvc: 2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 platform: - - Win32 -# - x64 +# - Win32 + - x64 configuration: - Debug # - Release # For the Qt, Boost, CMake, etc installs -os: Visual Studio 2015 +#os: Visual Studio 2017 # We want the git revision for versioning, # so shallow clones don't work. clone_depth: 1 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-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\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\ffmpeg-3.0.1-dev-win32.7z @@ -52,7 +48,7 @@ install: - set PATH=C:\Program Files\Git\mingw64\bin;%PATH% 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: - cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32 diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 4fc396cf6..b3a9ba940 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -174,8 +174,7 @@ add_component_dir (openmw-mp/Packets/Actor add_component_dir (openmw-mp/Packets/Player PlayerPacket - PacketHandshake PacketChatMessage PacketGUIBoxes PacketGUIWindow PacketGameSettings PacketGameTime - PacketGameWeather + PacketHandshake PacketChatMessage PacketGUIBoxes PacketGUIWindow PacketGameSettings PacketGameWeather PacketCellCreate PacketRecordDynamic @@ -199,6 +198,7 @@ add_component_dir (openmw-mp/Packets/Object add_component_dir (openmw-mp/Packets/Worldstate WorldstatePacket + PacketGameTime ) add_component_dir (fallback diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 4e407a317..226e471df 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -281,10 +281,7 @@ namespace mwmp RakNet::RakNetGUID guid; GUIMessageBox guiMessageBox; - int month; - int day; GUIWindow guiWindow; - double hour; // Track only the indexes of the attributes that have been changed, // with the attribute values themselves being stored in creatureStats.mAttributes diff --git a/components/openmw-mp/Base/BaseStructs.hpp b/components/openmw-mp/Base/BaseStructs.hpp index 208504c83..b76c61018 100644 --- a/components/openmw-mp/Base/BaseStructs.hpp +++ b/components/openmw-mp/Base/BaseStructs.hpp @@ -1,6 +1,8 @@ #ifndef OPENMW_BASESTRUCTS_HPP #define OPENMW_BASESTRUCTS_HPP +#include + #include #include diff --git a/components/openmw-mp/Base/BaseWorldstate.hpp b/components/openmw-mp/Base/BaseWorldstate.hpp index a823066f0..ba108a9e1 100644 --- a/components/openmw-mp/Base/BaseWorldstate.hpp +++ b/components/openmw-mp/Base/BaseWorldstate.hpp @@ -19,6 +19,10 @@ namespace mwmp RakNet::RakNetGUID guid; + int month; + int day; + double hour; + bool isValid; }; } diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 336cca88c..7500ebb2c 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -8,7 +8,6 @@ #include "../Packets/Player/PacketCellCreate.hpp" #include "../Packets/Player/PacketRecordDynamic.hpp" #include "../Packets/Player/PacketGameSettings.hpp" -#include "../Packets/Player/PacketGameTime.hpp" #include "../Packets/Player/PacketGameWeather.hpp" #include "../Packets/Player/PacketPlayerActiveSkills.hpp" #include "../Packets/Player/PacketPlayerAnimFlags.hpp" @@ -60,7 +59,6 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/Controllers/WorldstatePacketController.cpp b/components/openmw-mp/Controllers/WorldstatePacketController.cpp index 81806afb1..71f20ad43 100644 --- a/components/openmw-mp/Controllers/WorldstatePacketController.cpp +++ b/components/openmw-mp/Controllers/WorldstatePacketController.cpp @@ -1,6 +1,8 @@ +#include "../Packets/Worldstate/PacketGameTime.hpp" + #include "WorldstatePacketController.hpp" mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer) { - + AddPacket(&packets, peer); } diff --git a/components/openmw-mp/Packets/Player/PacketGameTime.cpp b/components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp similarity index 62% rename from components/openmw-mp/Packets/Player/PacketGameTime.cpp rename to components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp index 71027707e..8c1ff7ffc 100644 --- a/components/openmw-mp/Packets/Player/PacketGameTime.cpp +++ b/components/openmw-mp/Packets/Worldstate/PacketGameTime.cpp @@ -1,13 +1,9 @@ -// -// Created by koncord on 30.08.16. -// - #include "PacketGameTime.hpp" #include using namespace mwmp; -PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer) { packetID = ID_GAME_TIME; orderChannel = CHANNEL_SYSTEM; @@ -15,9 +11,9 @@ PacketGameTime::PacketGameTime(RakNet::RakPeerInterface *peer) : PlayerPacket(pe void PacketGameTime::Packet(RakNet::BitStream *bs, bool send) { - PlayerPacket::Packet(bs, send); + WorldstatePacket::Packet(bs, send); - RW(player->month, send); - RW(player->day, send); - RW(player->hour, send); + RW(worldstate->month, send); + RW(worldstate->day, send); + RW(worldstate->hour, send); } diff --git a/components/openmw-mp/Packets/Player/PacketGameTime.hpp b/components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp similarity index 63% rename from components/openmw-mp/Packets/Player/PacketGameTime.hpp rename to components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp index 2bafaab82..d1c505cb8 100644 --- a/components/openmw-mp/Packets/Player/PacketGameTime.hpp +++ b/components/openmw-mp/Packets/Worldstate/PacketGameTime.hpp @@ -1,15 +1,11 @@ -// -// Created by koncord on 30.08.16. -// - #ifndef OPENMW_PACKETGAMETIME_HPP #define OPENMW_PACKETGAMETIME_HPP -#include +#include namespace mwmp { - class PacketGameTime final: public PlayerPacket + class PacketGameTime final : public WorldstatePacket { public: PacketGameTime(RakNet::RakPeerInterface *peer);