From 4e485dbd4466f1ec075e4ad82dd7fb469e3f7d14 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 17 May 2018 12:57:58 +0300 Subject: [PATCH 01/11] Rename Original Creature column to Parent Creature (fixes #2897) --- apps/opencs/model/world/columns.cpp | 2 +- apps/opencs/model/world/columns.hpp | 2 +- apps/opencs/model/world/refidcollection.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 From f8304a52c489711a6ea97dc15966d0e51749dff6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 17:04:52 +0200 Subject: [PATCH 02/11] Enable verbose logging for CI --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d8f2bfc35..42aabab37 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,7 +52,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 From ea6c73333b6cbd6745b0eeed6c543ffede34f4fb Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 17:14:32 +0200 Subject: [PATCH 03/11] Bumping Qt to 5.10 for Appveyor --- CI/before_script.msvc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index a0cf06919..9b564a180 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -568,7 +568,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 +618,7 @@ fi echo Done. else - QT_SDK="C:/Qt/5.7/msvc${MSVC_YEAR}${SUFFIX}" + QT_SDK="C:/Qt/5.10/msvc${MSVC_YEAR}${SUFFIX}" add_cmake_opts -DDESIRED_QT_VERSION=5 \ -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ From 12b201348a6cf1b2f6e668654fd54396181c6b15 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 17:17:04 +0200 Subject: [PATCH 04/11] Switch to the supported VS versions on Appveyor --- appveyor.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 42aabab37..bce288a57 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,12 +8,12 @@ branches: environment: matrix: - - msvc: 2013 - msvc: 2015 + - msvc: 2017 platform: - - Win32 -# - x64 +# - Win32 + - x64 configuration: - Debug @@ -27,16 +27,10 @@ os: Visual Studio 2015 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 From e1e7a4b11adeeb51e4d565b5050f87268535bdd1 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 18:04:59 +0200 Subject: [PATCH 05/11] Change Appveyor to use Visual Studio 2017 --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bce288a57..ca6a59585 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ branches: environment: matrix: - - msvc: 2015 +# - msvc: 2015 - msvc: 2017 platform: @@ -20,7 +20,7 @@ configuration: # - 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. From bcfa2a13a6b3fa02f1691bf6fcf3dc6ed07bbc26 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 18:09:31 +0200 Subject: [PATCH 06/11] Use the VS2017 packaging of Qt5 for Appveyor --- CI/before_script.msvc.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 9b564a180..3b4b23027 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -385,7 +385,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 { @@ -411,7 +411,7 @@ fi if [ $MSVC_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 add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" @@ -618,7 +618,7 @@ fi echo Done. else - QT_SDK="C:/Qt/5.10/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" \ From 3bd8dc3ef6e4a178e715133c06ae562fc43ea9d4 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 18:22:02 +0200 Subject: [PATCH 07/11] Use the right boost version for Appveyor --- CI/before_script.msvc.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 3b4b23027..a4a436b48 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -216,6 +216,7 @@ case $VS_VERSION in 15|15.0|2017 ) GENERATOR="Visual Studio 15 2017" TOOLSET="vc140" + MSVC_REAL_VER="15" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2017" @@ -224,6 +225,7 @@ case $VS_VERSION in 14|14.0|2015 ) GENERATOR="Visual Studio 14 2015" TOOLSET="vc140" + MSVC_REAL_VER="14" MSVC_VER="14" MSVC_YEAR="2015" MSVC_DISPLAY_YEAR="2015" @@ -232,6 +234,7 @@ case $VS_VERSION in 12|12.0|2013 ) GENERATOR="Visual Studio 12 2013" TOOLSET="vc120" + MSVC_REAL_VER="12" MSVC_VER="12" MSVC_YEAR="2013" MSVC_DISPLAY_YEAR="2013" @@ -408,13 +411,19 @@ 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_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" + -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.${LIB_SUFFIX}" add_cmake_opts -DBoost_COMPILER="-${TOOLSET}" echo Done. From 4f758bdd4800fd6323f51c683a65bab2cdd6f91f Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 18:24:06 +0200 Subject: [PATCH 08/11] Use different environments for 2015 and 2017 --- appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ca6a59585..eae4bd5b1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,8 +8,10 @@ branches: environment: matrix: -# - msvc: 2015 + - msvc: 2015 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - msvc: 2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 platform: # - Win32 @@ -20,7 +22,7 @@ configuration: # - Release # For the Qt, Boost, CMake, etc installs -os: Visual Studio 2017 +#os: Visual Studio 2017 # We want the git revision for versioning, # so shallow clones don't work. From d05de8e4114d28a7e10d8d4d0d7e679d4b643348 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ananace\" Olofsson" Date: Sun, 20 May 2018 18:51:28 +0200 Subject: [PATCH 09/11] Give boost the correct toolset for 2017 --- CI/before_script.msvc.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index a4a436b48..9c12c45db 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -216,6 +216,7 @@ 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" @@ -225,6 +226,7 @@ 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" @@ -234,6 +236,7 @@ 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" @@ -424,7 +427,7 @@ fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -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. fi From e87e1dbb3013c2b09ac218809bce8e866f11a87f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 21 May 2018 07:12:55 +0300 Subject: [PATCH 10/11] [General] Fix Worldstate packets by adding missing lines --- apps/openmw-mp/Networking.cpp | 2 ++ apps/openmw/mwmp/processors/WorldstateProcessor.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index f6e7f6016..a2bda22ab 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -53,6 +53,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer) : mclient(nullptr) playerPacketController->SetStream(0, &bsOut); actorPacketController->SetStream(0, &bsOut); objectPacketController->SetStream(0, &bsOut); + worldstatePacketController->SetStream(0, &bsOut); running = true; exitCode = 0; @@ -74,6 +75,7 @@ Networking::~Networking() delete playerPacketController; delete actorPacketController; delete objectPacketController; + delete worldstatePacketController; } void Networking::setServerPassword(std::string passw) noexcept 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 "../Main.hpp" #include "../Networking.hpp" + #include "WorldstateProcessor.hpp" -#include "../Main.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) From 5af1150ab256ab3ad700e877723f2b44ae959440 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 21 May 2018 07:14:08 +0300 Subject: [PATCH 11/11] [General] Turn GameTime into a Worldstate packet --- .../openmw-mp/Script/Functions/Worldstate.cpp | 41 +++++++++++-------- apps/openmw/CMakeLists.txt | 19 +++++---- .../mwmp/processors/ObjectProcessor.cpp | 3 +- .../mwmp/processors/ProcessorInitializer.cpp | 5 ++- .../ProcessorGameTime.hpp | 22 ++++------ components/CMakeLists.txt | 3 +- components/openmw-mp/Base/BasePlayer.hpp | 3 -- components/openmw-mp/Base/BaseStructs.hpp | 2 + components/openmw-mp/Base/BaseWorldstate.hpp | 4 ++ .../Controllers/PlayerPacketController.cpp | 2 - .../WorldstatePacketController.cpp | 4 +- .../{Player => Worldstate}/PacketGameTime.cpp | 14 +++---- .../{Player => Worldstate}/PacketGameTime.hpp | 8 +--- 13 files changed, 68 insertions(+), 62 deletions(-) rename apps/openmw/mwmp/processors/{player => worldstate}/ProcessorGameTime.hpp (50%) rename components/openmw-mp/Packets/{Player => Worldstate}/PacketGameTime.cpp (62%) rename components/openmw-mp/Packets/{Player => Worldstate}/PacketGameTime.hpp (63%) diff --git a/apps/openmw-mp/Script/Functions/Worldstate.cpp b/apps/openmw-mp/Script/Functions/Worldstate.cpp index b95b67d14..0460e3915 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.cpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -6,20 +7,24 @@ #include "Worldstate.hpp" -#include using namespace std; +using namespace mwmp; + +BaseWorldstate writeWorldstate; void WorldstateFunctions::SetHour(unsigned short pid, double hour) noexcept { Player *player; GET_PLAYER(pid, player, ); - player->hour = hour; - player->month = -1; - player->day = -1; + writeWorldstate.guid = player->guid; + + writeWorldstate.hour = hour; + writeWorldstate.month = -1; + writeWorldstate.day = -1; - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); } void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept @@ -27,12 +32,14 @@ void WorldstateFunctions::SetMonth(unsigned short pid, int month) noexcept Player *player; GET_PLAYER(pid, player, ); - player->hour = -1; - player->month = month; - player->day = -1; + writeWorldstate.guid = player->guid; - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); + writeWorldstate.hour = -1; + writeWorldstate.month = month; + writeWorldstate.day = -1; + + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); } @@ -41,10 +48,12 @@ void WorldstateFunctions::SetDay(unsigned short pid, int day) noexcept Player *player; GET_PLAYER(pid, player, ); - player->hour = -1; - player->month = -1; - player->day = day; + writeWorldstate.guid = player->guid; + + writeWorldstate.hour = -1; + writeWorldstate.month = -1; + writeWorldstate.day = day; - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player); - mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->setWorldstate(&writeWorldstate); + mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_GAME_TIME)->Send(false); } diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 10384e004..ddea2b435 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 38cbc0a9c..95d32842e 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -8,7 +8,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" @@ -92,6 +91,7 @@ #include "actor/ProcessorActorTest.hpp" #include "WorldstateProcessor.hpp" +#include "worldstate/ProcessorGameTime.hpp" using namespace mwmp; @@ -104,7 +104,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()); @@ -184,4 +183,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/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 1ee0b7694..ce0180536 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 : public PlayerProcessor + class ProcessorGameTime : 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/components/CMakeLists.txt b/components/CMakeLists.txt index 3516104ed..6f6bfcc1f 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -174,7 +174,7 @@ add_component_dir (openmw-mp/Packets/Actor add_component_dir (openmw-mp/Packets/Player PlayerPacket - PacketHandshake PacketChatMessage PacketGUIBoxes PacketGameSettings PacketGameTime PacketGameWeather + PacketHandshake PacketChatMessage PacketGUIBoxes PacketGameSettings PacketGameWeather PacketCellCreate PacketRecordDynamic @@ -198,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 f625e1c0d..9cc13c71f 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -246,9 +246,6 @@ namespace mwmp RakNet::RakNetGUID guid; GUIMessageBox guiMessageBox; - int month; - int day; - 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 03fa30082..4f71d3b89 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 a9579e779..55c256adb 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -7,7 +7,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" @@ -66,7 +65,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 44d83c5c1..667d29b08 100644 --- a/components/openmw-mp/Controllers/WorldstatePacketController.cpp +++ b/components/openmw-mp/Controllers/WorldstatePacketController.cpp @@ -1,3 +1,5 @@ +#include "../Packets/Worldstate/PacketGameTime.hpp" + #include "WorldstatePacketController.hpp" template @@ -10,7 +12,7 @@ inline void AddPacket(mwmp::WorldstatePacketController::packets_t *packets, RakN 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 9f48f8674..e081e1d0c 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 : public PlayerPacket + class PacketGameTime : public WorldstatePacket { public: PacketGameTime(RakNet::RakPeerInterface *peer);