From de2513653e10af6648434aaf12f92bafbf5fb4fc Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 26 May 2018 19:51:50 +0400 Subject: [PATCH 01/15] AppVeyor: build with Release configuration --- CI/before_script.msvc.sh | 15 +++++++++++++-- CMakeLists.txt | 5 +---- appveyor.yml | 17 +++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 9c12c45db..16def0f8c 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -636,6 +636,17 @@ fi -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ -DCMAKE_PREFIX_PATH="$QT_SDK" + if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="d" + else + SUFFIX="" + fi + + DIR=$(echo "${QT_SDK}" | sed "s,\\\\,/,g" | sed "s,\(.\):,/\\1,") + + add_runtime_dlls "${DIR}/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll + add_qt_platform_dlls "${DIR}/plugins/platforms/qwindows${SUFFIX}.dll" + echo Done. fi } @@ -710,7 +721,7 @@ if [ ! -z $CI ]; then fi # NOTE: Disable this when/if we want to run test cases -if [ -z $CI ]; then +#if [ -z $CI ]; then echo "- Copying Runtime DLLs..." mkdir -p $BUILD_CONFIG for DLL in $RUNTIME_DLLS; do @@ -742,7 +753,7 @@ if [ -z $CI ]; then cp "$DLL" "${BUILD_CONFIG}/platforms" done echo -fi +#fi if [ -z $VERBOSE ]; then printf -- "- Configuring... " diff --git a/CMakeLists.txt b/CMakeLists.txt index bfef2d328..3cd1082f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,8 +360,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter") endif() elseif (MSVC) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /Zi /bigobj") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO") # Enable link-time code generation globally for all linking if (OPENMW_LTO_BUILD) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") @@ -707,8 +705,7 @@ if (WIN32) endif() if (BUILD_OPENMW) - # Very specific issue this, only needed on 32-bit VS2015 during unity builds. - if (MSVC_VERSION GREATER 1800 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND OPENMW_UNITY_BUILD) + if (OPENMW_UNITY_BUILD) set_target_properties(openmw PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD} /bigobj") else() set_target_properties(openmw PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") diff --git a/appveyor.yml b/appveyor.yml index 21fb7e1d6..97eaa0e26 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,8 @@ platform: configuration: # - Debug - - Release + - Release +# - RelWithDebInfo # For the Qt, Boost, CMake, etc installs #os: Visual Studio 2017 @@ -48,7 +49,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% -V + - cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -c %configuration% -p %PLATFORM% -v %msvc% -V build_script: - cmd: if %PLATFORM%==Win32 set build=MSVC%msvc%_32 @@ -56,8 +57,8 @@ build_script: - cmd: msbuild %build%\OpenMW.sln /t:Build /p:Configuration=%configuration% /m:2 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" after_build: - - cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_x64.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\Release\ -xr"!*.pdb" - - cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_x64_pdb.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\Release\*.pdb + - cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\%configuration%\ -xr"!*.pdb" + #- cmd: if %PLATFORM%==x64 7z a OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip %APPVEYOR_BUILD_FOLDER%\MSVC%msvc%_64\%configuration%\*.pdb test: off @@ -69,7 +70,7 @@ test: off # on_build_status_changed: true artifacts: - - path: OpenMW_MSVC%msvc%_x64.zip - name: OpenMW_MSVC%msvc%_x64 - - path: OpenMW_MSVC%msvc%_x64_pdb.zip - name: OpenMW_MSVC%msvc%_x64_pdb + - path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%.zip + name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit% + #- path: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb.zip + # name: OpenMW_MSVC%msvc%_%platform%_%appveyor_pull_request_number%_%appveyor_pull_request_head_commit%_pdb From be394870e49daa642a3998aa2f4a6d47e267e518 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 1 Jun 2018 19:28:06 +0400 Subject: [PATCH 02/15] Fix regressions in spell resistance --- apps/openmw/mwmechanics/spellcasting.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmechanics/spellcasting.cpp b/apps/openmw/mwmechanics/spellcasting.cpp index 1f78e296f..d71b4c8ba 100644 --- a/apps/openmw/mwmechanics/spellcasting.cpp +++ b/apps/openmw/mwmechanics/spellcasting.cpp @@ -221,7 +221,6 @@ namespace MWMechanics if (effects) magicEffects = effects; - float resisted = 0; // Effects with no resistance attribute belonging to them can not be resisted if (ESM::MagicEffect::getResistanceEffect(effectId) == -1) return 0.f; @@ -256,10 +255,7 @@ namespace MWMechanics } x = std::min(x + resistance, 100.f); - - resisted = x; - - return resisted; + return x; } float getEffectMultiplier(short effectId, const MWWorld::Ptr& actor, const MWWorld::Ptr& caster, @@ -456,10 +452,11 @@ namespace MWMechanics float magnitudeMult = 1; - if (!absorbed) + if (!absorbed && target.getClass().isActor()) { + bool isHarmful = magicEffect->mData.mFlags & ESM::MagicEffect::Harmful; // Reflect harmful effects - if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful && !reflected && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable)) + if (isHarmful && !reflected && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable)) { float reflect = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::Reflect).getMagnitude(); bool isReflected = (Misc::Rng::roll0to99() < reflect); @@ -483,17 +480,17 @@ namespace MWMechanics else if (castByPlayer) MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}"); } - else if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful && castByPlayer && target != caster) + else if (isHarmful && castByPlayer && target != caster) { // If player is attempting to cast a harmful spell and it wasn't fully resisted, show the target's HP bar MWBase::Environment::get().getWindowManager()->setEnemy(target); } - if (target == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState()) + if (target == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState() && isHarmful) magnitudeMult = 0; // Notify the target actor they've been hit - if (target != caster && !caster.isEmpty() && magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) + if (target != caster && !caster.isEmpty() && isHarmful) target.getClass().onHit(target, 0.0f, true, MWWorld::Ptr(), caster, osg::Vec3f(), true); } From dba79f4d4dd2e59f3f1ce41c9dacdd55c99c32eb Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 2 Jun 2018 14:28:05 +0300 Subject: [PATCH 03/15] Fix warnings: catching polymorphic type by value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openmw/apps/openmw/mwworld/worldimp.cpp: In member function ‘virtual bool MWWorld::World::findExteriorPosition(const string&, ESM::Position&)’: openmw/apps/openmw/mwworld/worldimp.cpp:2650:25: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=] catch (std::invalid_argument) ^~~~~~~~~~~~~~~~ openmw/apps/openmw/mwworld/worldimp.cpp:2654:25: warning: catching polymorphic type ‘class std::out_of_range’ by value [-Wcatch-value=] catch (std::out_of_range) ^~~~~~~~~~~~ openmw/components/widgets/numericeditbox.cpp: In member function ‘void Gui::NumericEditBox::onEditTextChange(MyGUI::EditBox*)’: openmw/components/widgets/numericeditbox.cpp:41:21: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=] catch (std::invalid_argument) ^~~~~~~~~~~~~~~~ openmw/components/widgets/numericeditbox.cpp:45:21: warning: catching polymorphic type ‘class std::out_of_range’ by value [-Wcatch-value=] catch (std::out_of_range) ^~~~~~~~~~~~ --- apps/openmw/mwworld/worldimp.cpp | 4 ++-- components/widgets/numericeditbox.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 6cf1ead87..6579996d2 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2601,11 +2601,11 @@ namespace MWWorld int y = std::stoi(name.substr(name.find(',')+1)); ext = getExterior(x, y)->getCell(); } - catch (std::invalid_argument) + catch (const std::invalid_argument&) { // This exception can be ignored, as this means that name probably refers to a interior cell instead of comma separated coordinates } - catch (std::out_of_range) + catch (const std::out_of_range&) { throw std::runtime_error("Cell coordinates out of range."); } diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index ee2c30a7b..efe480653 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -38,11 +38,11 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (std::invalid_argument) + catch (const std::invalid_argument&) { setCaption(MyGUI::utility::toString(mValue)); } - catch (std::out_of_range) + catch (const std::out_of_range&) { setCaption(MyGUI::utility::toString(mValue)); } From eecde340cf33dbf2d30a696e68948253c710f01e Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 2 Jun 2018 15:41:05 +0300 Subject: [PATCH 04/15] Make weapon health short unsigned (fixes #4435) --- components/esm/loadweap.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esm/loadweap.hpp b/components/esm/loadweap.hpp index eddcaee4f..8b48b71b7 100644 --- a/components/esm/loadweap.hpp +++ b/components/esm/loadweap.hpp @@ -57,7 +57,7 @@ struct Weapon float mWeight; int mValue; short mType; - short mHealth; + unsigned short mHealth; float mSpeed, mReach; short mEnchant; // Enchantment points. The real value is mEnchant/10.f unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max From c71df7249da6295774df2c3f156730157ef9c792 Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 26 May 2018 16:09:12 +0300 Subject: [PATCH 05/15] Fix UTF-8 econding To be able run gcovr --- extern/oics/ICSInputControlSystem_mouse.cpp | 4 ++-- extern/oics/tinystr.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extern/oics/ICSInputControlSystem_mouse.cpp b/extern/oics/ICSInputControlSystem_mouse.cpp index 5decaf1eb..e389bc981 100644 --- a/extern/oics/ICSInputControlSystem_mouse.cpp +++ b/extern/oics/ICSInputControlSystem_mouse.cpp @@ -268,11 +268,11 @@ namespace ICS ctrl->setIgnoreAutoReverse(true); if(mouseBinderItem.direction == Control::INCREASE) { - ctrl->setValue( float( (evt.state.Z.abs) / float(evt.state.¿width?) ) ); + ctrl->setValue( float( (evt.state.Z.abs) / float(evt.state.¿width?) ) ); } else if(mouseBinderItem.direction == Control::DECREASE) { - ctrl->setValue( float( (1 - evt.state.Z.abs) / float(evt.state.¿width?) ) ); + ctrl->setValue( float( (1 - evt.state.Z.abs) / float(evt.state.¿width?) ) ); } }*/ } diff --git a/extern/oics/tinystr.cpp b/extern/oics/tinystr.cpp index 681250714..635e84b5f 100644 --- a/extern/oics/tinystr.cpp +++ b/extern/oics/tinystr.cpp @@ -23,7 +23,7 @@ distribution. */ /* - * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005. + * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005. */ From cae744161bfe7b22612ce54a96399d919fd5b2ed Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Jun 2018 15:08:22 +0200 Subject: [PATCH 06/15] increased version number --- CMakeLists.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3cd1082f0..15ca3efb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ endif() message(STATUS "Configuring OpenMW...") set(OPENMW_VERSION_MAJOR 0) -set(OPENMW_VERSION_MINOR 43) +set(OPENMW_VERSION_MINOR 44) set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_COMMITHASH "") diff --git a/README.md b/README.md index 368609332..d6a3323a1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ OpenMW is a recreation of the engine for the popular role-playing game Morrowind OpenMW also comes with OpenMW-CS, a replacement for Morrowind's TES Construction Set. -* Version: 0.43.0 +* Version: 0.44.0 * License: GPLv3 (see [LICENSE](https://github.com/OpenMW/openmw/blob/master/LICENSE) for more information) * Website: https://www.openmw.org * IRC: #openmw on irc.freenode.net From 2193983a6941d21739723fc0def7fa04640dfe2b Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Jun 2018 15:14:35 +0200 Subject: [PATCH 07/15] updated changelog --- CHANGELOG.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac2a5472e..3dcad4598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,101 @@ +0.44.0 +------ + + Bug #1428: Daedra summoning scripts aren't executed when the item is taken through the inventory + Bug #1987: Some glyphs are not supported + Bug #2254: Magic related visual effects are not rendered when loading a saved game + Bug #2485: Journal alphabetical index doesn't match "Morrowind content language" setting + Bug #2703: OnPCHitMe is not handled correctly + Bug #2829: Incorrect order for content list consisting of a game file and an esp without dependencies + Bug #2841: "Total eclipse" happens if weather settings are not defined. + Bug #2897: Editor: Rename "Original creature" field + Bug #3278: Editor: Unchecking "Auto Calc" flag changes certain values + Bug #3343: Editor: ID sorting is case-sensitive in certain tables + Bug #3557: Resource priority confusion when using the local data path as installation root + Bug #3587: Pathgrid and Flying Creatures wrong behaviour – abotWhereAreAllBirdsGoing + Bug #3603: SetPos should not skip weather transitions + Bug #3618: Myar Aranath total conversion can't be started due to capital-case extension of the master file + Bug #3638: Fast forwarding can move NPC inside objects + Bug #3664: Combat music does not start in dialogue + Bug #3696: Newlines are accompanied by empty rectangle glyph in dialogs + Bug #3708: Controllers broken on macOS + Bug #3726: Items with suppressed activation can be picked up via the inventory menu + Bug #3783: [Mod] Abot's Silt Striders 1.16 - silt strider "falls" to ground and glides on floor during travel + Bug #3863: Can be forced to not resist arrest if you cast Calm Humanoid on aggroed death warrant guards + Bug #3884: Incorrect enemy behavior when exhausted + Bug #3926: Installation Wizard places Morrowind.esm after Tribunal/Bloodmoon if it has a later file creation date + Bug #4061: Scripts error on special token included in name + Bug #4111: Crash when mouse over soulgem with a now-missing soul + Bug #4122: Swim animation should not be interrupted during underwater attack + Bug #4134: Battle music behaves different than vanilla + Bug #4135: Reflecting an absorb spell different from vanilla + Bug #4136: Enchanted weapons without "ignore normal weapons" flag don't bypass creature "ignore normal weapons" effect + Bug #4143: Antialiasing produces graphical artifacts when used with shader lighting + Bug #4159: NPCs' base skeleton files should not be optimized + Bug #4177: Jumping/landing animation interference/flickering + Bug #4179: NPCs do not face target + Bug #4180: Weapon switch sound playing even though no weapon is switched + Bug #4184: Guards can initiate dialogue even though you are far above them + Bug #4190: Enchanted clothes changes visibility with Chameleon on equip/unequip + Bug #4191: "screenshot saved" message also appears in the screenshot image + Bug #4192: Archers in OpenMW have shorter attack range than archers in Morrowind + Bug #4210: Some dialogue topics are not highlighted on first encounter + Bug #4211: FPS drops after minimizing the game during rainy weather + Bug #4216: Thrown weapon projectile doesn't rotate + Bug #4223: Displayed spell casting chance must be 0 if player doesn't have enough magicka to cast it + Bug #4225: Double "Activate" key presses with Mouse and Gamepad. + Bug #4226: The current player's class should be default value in the class select menu + Bug #4229: Tribunal/Bloodmoon summoned creatures fight other summons + Bug #4233: W and A keys override S and D Keys + Bug #4235: Wireframe mode affects local map + Bug #4239: Quick load from container screen causes crash + Bug #4242: Crime greetings display in Journal + Bug #4245: Merchant NPCs sell ingredients growing on potted plants they own + Bug #4246: Take armor condition into account when calcuting armor rating + Bug #4250: Jumping is not as fluid as it was pre-0.43.0 + Bug #4252: "Error in frame: FFmpeg exception: Failed to allocate input stream" message spam if OpenMW encounter non-music file in the Music folder + Bug #4261: Magic effects from eaten ingredients always have 1 sec duration + Bug #4263: Arrow position is incorrect in 3rd person view during attack for beast races + Bug #4264: Player in god mode can be affected by some negative spell effects + Bug #4269: Crash when hovering the faction section and the 'sAnd' GMST is missing (as in MW 1.0) + Bug #4272: Root note transformations are discarded again + Bug #4279: Sometimes cells are not marked as explored on the map + Bug #4298: Problem with MessageBox and chargen menu interaction order + Bug #4301: Optimizer breaks LOD nodes + Bug #4308: PlaceAtMe doesn't inherit scale of calling object + Bug #4309: Only harmful effects with resistance effect set are resistable + Bug #4313: Non-humanoid creatures are capable of opening doors + Bug #4314: Rainy weather slows down the game when changing from indoors/outdoors + Bug #4319: Collisions for certain meshes are incorrectly ignored + Bug #4320: Using mouse 1 to move forward causes selection dialogues to jump selections forward. + Bug #4322: NPC disposition: negative faction reaction modifier doesn't take PC rank into account + Bug #4328: Ownership by dead actors is not cleared from picked items + Bug #4334: Torch and shield usage inconsistent with original game + Bug #4336: Wizard: Incorrect Morrowind assets path autodetection + Bug #4343: Error message for coc and starting cell shouldn't imply that it only works for interior cells + Bug #4346: Count formatting does not work well with very high numbers + Bug #4351: Using AddSoulgem fills all soul gems of the specified type + Bug #4391: No visual indication is provided when an unavailable spell fails to be chosen via a quick key + Bug #4392: Inventory filter breaks after loading a game + Bug #4405: No default terrain in empty cells when distant terrain is enabled + Bug #4410: [Mod] Arktwend: OpenMW does not use default marker definitions + Bug #4412: openmw-iniimporter ignores data paths from config + Bug #4413: Moving with 0 strength uses all of your fatigue + Bug #4420: Camera flickering when I open up and close menus while sneaking + Bug #4435: Item health is considered a signed integer + Feature #1786: Round up encumbrance value in the encumbrance bar + Feature #2694: Editor: rename "model" column to make its purpose clear + Feature #3870: Editor: Terrain Texture Brush Button + Feature #3872: Editor: Edit functions in terrain texture editing mode + Feature #4054: Launcher: Create menu for settings.cfg options + Feature #4064: Option for fast travel services to charge for the first companion + Feature #4142: Implement fWereWolfHealth GMST + Feature #4174: Multiple quicksaves + Feature #4407: Support NiLookAtController + Feature #4423: Rebalance soul gem values + Task #4015: Use AppVeyor build artifact features to make continuous builds available + Editor: New (and more complete) icon set + 0.43.0 ------ From 13f7b53b1caeec5abc3e07e1c4f7c3e50a1ae249 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Jun 2018 17:08:09 +0200 Subject: [PATCH 08/15] Revert "Don't force DDS file usage (fixes #1392)" This reverts commit 90f3ff2da4b37a6766e0eb369150d866ec488d06. --- components/misc/resourcehelpers.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/components/misc/resourcehelpers.cpp b/components/misc/resourcehelpers.cpp index f38387ff8..5cf4378b8 100644 --- a/components/misc/resourcehelpers.cpp +++ b/components/misc/resourcehelpers.cpp @@ -63,16 +63,28 @@ std::string Misc::ResourceHelpers::correctResourcePath(const std::string &topLev std::string origExt = correctedPath; - if (vfs->exists(origExt) - || (changeExtensionToDds(correctedPath) && vfs->exists(correctedPath))) + // since we know all (GOTY edition or less) textures end + // in .dds, we change the extension + bool changedToDds = changeExtensionToDds(correctedPath); + if (vfs->exists(correctedPath)) return correctedPath; + // if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods) + // verify, and revert if false (this call succeeds quickly, but fails slowly) + if (changedToDds && vfs->exists(origExt)) + return origExt; // fall back to a resource in the top level directory if it exists - std::string fallback = topLevelDirectory + "\\" + getBasename(origExt); - if (vfs->exists(fallback) - || (changeExtensionToDds(fallback) && vfs->exists(fallback))) + std::string fallback = topLevelDirectory + "\\" + getBasename(correctedPath); + if (vfs->exists(fallback)) return fallback; + if (changedToDds) + { + fallback = topLevelDirectory + "\\" + getBasename(origExt); + if (vfs->exists(fallback)) + return fallback; + } + return correctedPath; } From 8ea9485e6bbf36eba793bbd54a74d0aede72539b Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 12:01:16 +0300 Subject: [PATCH 09/15] [Client] Make container debug information more useful --- apps/openmw/mwmp/ObjectList.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmp/ObjectList.cpp b/apps/openmw/mwmp/ObjectList.cpp index 2320fedf6..481e472a3 100644 --- a/apps/openmw/mwmp/ObjectList.cpp +++ b/apps/openmw/mwmp/ObjectList.cpp @@ -80,13 +80,16 @@ void ObjectList::addContainerItem(mwmp::BaseObject& baseObject, const MWWorld::P containerItem.enchantmentCharge = itemPtr.getCellRef().getEnchantmentCharge(); containerItem.actionCount = actionCount; - LOG_APPEND(Log::LOG_INFO, "-- Adding container item %s", containerItem.refId.c_str()); + LOG_APPEND(Log::LOG_INFO, "--- Adding container item %s", containerItem.refId.c_str()); baseObject.containerItems.push_back(containerItem); } void ObjectList::addEntireContainer(const MWWorld::Ptr& ptr) { + LOG_APPEND(Log::LOG_INFO, "-- Adding entire container %s %i-%i", ptr.getCellRef().getRefId().c_str(), + ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum()); + MWWorld::ContainerStore& containerStore = ptr.getClass().getContainerStore(ptr); mwmp::BaseObject baseObject = getBaseObject(ptr); @@ -111,14 +114,14 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore) { baseObject = baseObjects.at(i); - //LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); if (ptrFound) { - //LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), - // ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); + LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(), + ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum()); bool isCurrentContainer = false; bool hasActorEquipment = ptrFound.getClass().isActor() && ptrFound.getClass().hasInventoryStore(ptrFound); From 7605d928dbcc4c4fa6b0022fc40afa8d5e3e26c0 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 5 Jun 2018 11:03:04 +0200 Subject: [PATCH 10/15] added section for 0.45 to changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dcad4598..49c0f3ef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +0.45.0 +------ + + 0.44.0 ------ From c24157f6f9905f78c7e5bd5ff2cf0061eb6cc8e3 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 13:14:52 +0300 Subject: [PATCH 11/15] [General] Fix CMakeLists in components for BaseObject --- components/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 72b79adf8..a3950edcd 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -150,7 +150,7 @@ add_component_dir (openmw-mp ) add_component_dir (openmw-mp/Base - BaseActor BaseObjectList BasePacketProcessor BasePlayer BaseStructs BaseWorldstate + BaseActor BaseObject BasePacketProcessor BasePlayer BaseStructs BaseWorldstate ) add_component_dir (openmw-mp/Controllers From 494edbe5cb998403e31000cdbd62da41e2bda398 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 14:16:27 +0300 Subject: [PATCH 12/15] [General] Add REPLY_TO_REQUEST container sub-action --- apps/openmw/mwmp/processors/object/ProcessorContainer.hpp | 1 + components/openmw-mp/Base/BaseObject.hpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp b/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp index f5aee6947..df01e13ea 100644 --- a/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp +++ b/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp @@ -29,6 +29,7 @@ namespace mwmp objectList.reset(); objectList.cell = *ptrCellStore->getCell(); objectList.action = mwmp::BaseObjectList::SET; + objectList.containerSubAction = mwmp::BaseObjectList::REPLY_TO_REQUEST; objectList.addAllContainers(ptrCellStore); objectList.sendContainer(); } diff --git a/components/openmw-mp/Base/BaseObject.hpp b/components/openmw-mp/Base/BaseObject.hpp index 295a80c90..02f40097b 100644 --- a/components/openmw-mp/Base/BaseObject.hpp +++ b/components/openmw-mp/Base/BaseObject.hpp @@ -94,7 +94,8 @@ namespace mwmp NONE = 0, DRAG = 1, DROP = 2, - TAKE_ALL = 3 + TAKE_ALL = 3, + REPLY_TO_REQUEST = 4 }; RakNet::RakNetGUID guid; @@ -106,7 +107,7 @@ namespace mwmp std::string consoleCommand; unsigned char action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item, 3 - Request items - unsigned char containerSubAction; // 0 - None, 1 - Drag, 2 - Take all + unsigned char containerSubAction; // 0 - None, 1 - Drag, 2 - Drop, 3 - Take all, 4 - Reply to request bool isValid; }; From bacecc93e31f27308418939c2425a35d4f7d004c Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 14:19:06 +0300 Subject: [PATCH 13/15] [Server] Make it possible to resend a received ObjectList of any kind Additionally, make existing related functions less confusing. --- apps/openmw-mp/Script/Functions/Objects.cpp | 34 +++++++++++++-------- apps/openmw-mp/Script/Functions/Objects.hpp | 34 ++++++++++++++++----- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Objects.cpp b/apps/openmw-mp/Script/Functions/Objects.cpp index 5b4f4cb68..c8aa8a652 100644 --- a/apps/openmw-mp/Script/Functions/Objects.cpp +++ b/apps/openmw-mp/Script/Functions/Objects.cpp @@ -24,16 +24,25 @@ void ObjectFunctions::ReadLastObjectList() noexcept readObjectList = mwmp::Networking::getPtr()->getLastObjectList(); } -void ObjectFunctions::InitializeObjectList(unsigned short pid) noexcept +void ObjectFunctions::ClearObjectList() noexcept +{ + writeObjectList.cell.blank(); + writeObjectList.baseObjects.clear(); +} + +void ObjectFunctions::SetObjectListPid(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - writeObjectList.cell.blank(); - writeObjectList.baseObjects.clear(); writeObjectList.guid = player->guid; } +void ObjectFunctions::CopyLastObjectListToStore() noexcept +{ + writeObjectList = *readObjectList; +} + unsigned int ObjectFunctions::GetObjectChangesSize() noexcept { return readObjectList->baseObjectCount; @@ -315,9 +324,9 @@ void ObjectFunctions::SetContainerItemEnchantmentCharge(double enchantmentCharge tempContainerItem.enchantmentCharge = enchantmentCharge; } -void ObjectFunctions::SetReceivedContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept +void ObjectFunctions::SetContainerItemActionCountByIndex(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept { - readObjectList->baseObjects.at(objectIndex).containerItems.at(itemIndex).actionCount = actionCount; + writeObjectList.baseObjects.at(objectIndex).containerItems.at(itemIndex).actionCount = actionCount; } void ObjectFunctions::AddObject() noexcept @@ -425,15 +434,10 @@ void ObjectFunctions::SendDoorDestination(bool broadcast) noexcept packet->Send(true); } -void ObjectFunctions::SendContainer(bool broadcast, bool useLastReadObjectList) noexcept +void ObjectFunctions::SendContainer(bool broadcast) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONTAINER); - - if (useLastReadObjectList) - packet->setObjectList(readObjectList); - else - packet->setObjectList(&writeObjectList); - + packet->setObjectList(&writeObjectList); packet->Send(false); if (broadcast) @@ -457,6 +461,12 @@ void ObjectFunctions::ReadLastEvent() noexcept ReadLastObjectList(); } +void ObjectFunctions::InitializeObjectList(unsigned short pid) noexcept +{ + ClearObjectList(); + SetObjectListPid(pid); +} + void ObjectFunctions::InitializeEvent(unsigned short pid) noexcept { InitializeObjectList(pid); diff --git a/apps/openmw-mp/Script/Functions/Objects.hpp b/apps/openmw-mp/Script/Functions/Objects.hpp index 4e5c3d6ce..47a3dffa5 100644 --- a/apps/openmw-mp/Script/Functions/Objects.hpp +++ b/apps/openmw-mp/Script/Functions/Objects.hpp @@ -3,7 +3,11 @@ #define OBJECTAPI \ {"ReadLastObjectList", ObjectFunctions::ReadLastObjectList},\ - {"InitializeObjectList", ObjectFunctions::InitializeObjectList},\ + \ + {"ClearObjectList", ObjectFunctions::ClearObjectList},\ + {"SetObjectListPid", ObjectFunctions::SetObjectListPid},\ + \ + {"CopyLastObjectListToStore", ObjectFunctions::CopyLastObjectListToStore},\ \ {"GetObjectChangesSize", ObjectFunctions::GetObjectChangesSize},\ {"GetObjectListAction", ObjectFunctions::GetObjectListAction},\ @@ -66,7 +70,7 @@ {"SetContainerItemCharge", ObjectFunctions::SetContainerItemCharge},\ {"SetContainerItemEnchantmentCharge", ObjectFunctions::SetContainerItemEnchantmentCharge},\ \ - {"SetReceivedContainerItemActionCount", ObjectFunctions::SetReceivedContainerItemActionCount},\ + {"SetContainerItemActionCountByIndex", ObjectFunctions::SetContainerItemActionCountByIndex},\ \ {"AddObject", ObjectFunctions::AddObject},\ {"AddContainerItem", ObjectFunctions::AddContainerItem},\ @@ -84,6 +88,7 @@ {"SendConsoleCommand", ObjectFunctions::SendConsoleCommand},\ \ {"ReadLastEvent", ObjectFunctions::ReadLastEvent},\ + {"InitializeObjectList", ObjectFunctions::InitializeObjectList},\ {"InitializeEvent", ObjectFunctions::InitializeEvent},\ {"GetEventAction", ObjectFunctions::GetEventAction},\ {"GetEventContainerSubAction", ObjectFunctions::GetEventContainerSubAction},\ @@ -106,12 +111,26 @@ public: /** * \brief Clear the data from the last object list sent by the server. * - * This is used to initialize the sending of new Object packets. + * \return void + */ + static void ClearObjectList() noexcept; + + /** + * \brief Set the pid attached to the ObjectList. * * \param pid The player ID to whom the object list should be attached. * \return void */ - static void InitializeObjectList(unsigned short pid) noexcept; + static void SetObjectListPid(unsigned short pid) noexcept; + + /** + * \brief Take the contents of the read-only object list last received by the + * server from a player and move its contents to the stored object list + * that can be sent by the server. + * + * \return void + */ + static void CopyLastObjectListToStore() noexcept; /** * \brief Get the number of indexes in the read object list's object changes. @@ -612,7 +631,7 @@ public: /** * \brief Set the action count of the container item at a certain itemIndex in the container - * changes of the object at a certain objectIndex in the read object list's object changes. + * changes of the object at a certain objectIndex in the object list stored on the server. * * When resending a received Container packet, this allows you to correct the amount of items * removed from a container by a player when it conflicts with what other players have already @@ -623,7 +642,7 @@ public: * \param actionCount The action count. * \return void */ - static void SetReceivedContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept; + static void SetContainerItemActionCountByIndex(unsigned int objectIndex, unsigned int itemIndex, int actionCount) noexcept; /** * \brief Add a copy of the server's temporary object to the server's temporary object list. @@ -744,7 +763,7 @@ public: * * \return void */ - static void SendContainer(bool broadcast = false, bool useLastReadObjectList = false) noexcept; + static void SendContainer(bool broadcast = false) noexcept; /** * \brief Send a ConsoleCommand packet. @@ -760,6 +779,7 @@ public: // All methods below are deprecated versions of methods from above static void ReadLastEvent() noexcept; + static void InitializeObjectList(unsigned short pid) noexcept; static void InitializeEvent(unsigned short pid) noexcept; static unsigned char GetEventAction() noexcept; static unsigned char GetEventContainerSubAction() noexcept; From 83014d6381f0030293ebcac04e591bc328f5643f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 14:55:57 +0300 Subject: [PATCH 14/15] [Client] Set actors as the owners of their items when editing containers --- apps/openmw/mwmp/ObjectList.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmp/ObjectList.cpp b/apps/openmw/mwmp/ObjectList.cpp index 481e472a3..72fc20572 100644 --- a/apps/openmw/mwmp/ObjectList.cpp +++ b/apps/openmw/mwmp/ObjectList.cpp @@ -149,7 +149,8 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore) bool isLocalTakeAll = isLocalEvent && containerSubAction == BaseObjectList::TAKE_ALL; std::string takeAllSound = ""; - MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr(); + MWWorld::Ptr ownerPtr = ptrFound.getClass().isActor() ? ptrFound : MWBase::Environment::get().getWorld()->getPlayerPtr(); + for (const auto &containerItem : baseObject.containerItems) { //LOG_APPEND(Log::LOG_VERBOSE, "-- containerItem cellRef: %s, count: %i, actionCount: %i", From 0d0c4ac2351162ffbf1a2dfd5d01663039350da0 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 19:40:39 +0300 Subject: [PATCH 15/15] [Client] Use REPLY_TO_REQUEST container sub-action for partial requests --- apps/openmw/mwmp/processors/object/ProcessorContainer.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp b/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp index df01e13ea..59d582935 100644 --- a/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp +++ b/apps/openmw/mwmp/processors/object/ProcessorContainer.hpp @@ -40,6 +40,7 @@ namespace mwmp objectList.reset(); objectList.cell = *ptrCellStore->getCell(); objectList.action = mwmp::BaseObjectList::SET; + objectList.containerSubAction = mwmp::BaseObjectList::REPLY_TO_REQUEST; objectList.addRequestedContainers(ptrCellStore, requestObjects); if (objectList.baseObjects.size() > 0)