From bba822c014fbc60a3839dc9d7ad4d563dec10758 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 26 Apr 2017 17:18:06 +0400 Subject: [PATCH 1/8] Purge all effects with same ID instead only first (fixes #3839) --- apps/openmw/mwworld/inventorystore.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index fd7cb5d74..a6394757f 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -938,7 +938,6 @@ void MWWorld::InventoryStore::purgeEffect(short effectId, const std::string &sou mMagicEffects.add (*effectIt, -magnitude); params[i].mMultiplier = 0; - break; } } } From d24bcbac152090f4a86148d2e98b70130346f93c Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sun, 30 Apr 2017 18:49:32 +0200 Subject: [PATCH 2/8] Do not apply underwater effects to player's voice (Fixes #3850) --- apps/openmw/mwsound/soundmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 9b5fb1b3d..53c0643f6 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -259,7 +259,7 @@ namespace MWSound float basevol = volumeFromType(Play_TypeVoice); if(playlocal) { - sound.reset(new Stream(1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice|Play_2D)); + sound.reset(new Stream(1.0f, basevol, 1.0f, Play_NoEnv|Play_TypeVoice|Play_2D)); mOutput->streamSound(decoder, sound); } else From ae05c37a468aa22fd8cdb1bf2d6c3051a4b07651 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 6 May 2017 09:21:02 +0200 Subject: [PATCH 3/8] Update Windows CI scripts to use ffmpeg 3.2.4 --- CI/before_script.msvc.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index aa8c565ba..06ab1fa14 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -305,11 +305,11 @@ if [ -z $SKIP_DOWNLOAD ]; then "Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z" # FFmpeg - download "FFmpeg 3.0.1" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.0.1-win${BITS}-shared.7z" \ - "ffmpeg-3.0.1-win${BITS}.7z" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.0.1-win${BITS}-dev.7z" \ - "ffmpeg-3.0.1-dev-win${BITS}.7z" + download "FFmpeg 3.2.4" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.7z" \ + "ffmpeg-3.2.4-win${BITS}.7z" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.7z" \ + "ffmpeg-3.2.4-dev-win${BITS}.7z" # MyGUI download "MyGUI 3.2.3-git" \ @@ -434,21 +434,21 @@ cd $DEPS echo # FFmpeg -printf "FFmpeg 3.0.1... " +printf "FFmpeg 3.2.4... " { cd $DEPS_INSTALL - if [ -d FFmpeg ] && grep "FFmpeg version: 3.0.1" FFmpeg/README.txt > /dev/null; then + if [ -d FFmpeg ] && grep "FFmpeg version: 3.2.4" FFmpeg/README.txt > /dev/null; then printf "Exists. " elif [ -z $SKIP_EXTRACT ]; then rm -rf FFmpeg - eval 7z x -y "${DEPS}/ffmpeg-3.0.1-win${BITS}.7z" $STRIP - eval 7z x -y "${DEPS}/ffmpeg-3.0.1-dev-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.7z" $STRIP - mv "ffmpeg-3.0.1-win${BITS}-shared" FFmpeg - cp -r "ffmpeg-3.0.1-win${BITS}-dev/"* FFmpeg/ - rm -rf "ffmpeg-3.0.1-win${BITS}-dev" + mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg + cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/ + rm -rf "ffmpeg-3.2.4-win${BITS}-dev" fi export FFMPEG_HOME="$(real_pwd)/FFmpeg" @@ -755,4 +755,4 @@ if [ -z $CI ]; then echo fi -exit $RET \ No newline at end of file +exit $RET From fd03c76e68d00f9426e1332a35f0d029814a6468 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sat, 6 May 2017 09:38:14 +0200 Subject: [PATCH 4/8] And apparently they're only doing zips now --- CI/before_script.msvc.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 06ab1fa14..5aa76de92 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -306,10 +306,10 @@ if [ -z $SKIP_DOWNLOAD ]; then # FFmpeg download "FFmpeg 3.2.4" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.7z" \ - "ffmpeg-3.2.4-win${BITS}.7z" \ - "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.7z" \ - "ffmpeg-3.2.4-dev-win${BITS}.7z" + "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.zip" \ + "ffmpeg-3.2.4-win${BITS}.zip" \ + "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.zip" \ + "ffmpeg-3.2.4-dev-win${BITS}.zip" # MyGUI download "MyGUI 3.2.3-git" \ @@ -443,8 +443,8 @@ printf "FFmpeg 3.2.4... " elif [ -z $SKIP_EXTRACT ]; then rm -rf FFmpeg - eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.7z" $STRIP - eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.7z" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.zip" $STRIP + eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.zip" $STRIP mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/ From 813af876f6508bd2d17cdac6eabc3f5a2f24cda4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 May 2017 23:28:56 +0200 Subject: [PATCH 5/8] Use a partial binary search in isReservedName (Fixes #3835) --- apps/openmw_test_suite/CMakeLists.txt | 2 + .../openmw_test_suite/misc/test_stringops.cpp | 44 +++++++++++++++++++ components/misc/stringops.hpp | 24 ++++++++++ components/resource/scenemanager.cpp | 15 +++++-- 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 apps/openmw_test_suite/misc/test_stringops.cpp diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index 24ea1835a..ea4b1209c 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -11,6 +11,8 @@ if (GTEST_FOUND) mwdialogue/test_keywordsearch.cpp esm/test_fixed_string.cpp + + misc/test_stringops.cpp ) source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES}) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp new file mode 100644 index 000000000..c47e49724 --- /dev/null +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -0,0 +1,44 @@ +#include +#include "components/misc/stringops.hpp" + +struct PartialBinarySearchTest : public ::testing::Test +{ + protected: + std::vector mDataVec; + virtual void SetUp() + { + const char* data[] = { "Head", "Chest", "Tri Head", "Tri Chest", "Bip01" }; + mDataVec = std::vector(data, data+sizeof(data)/sizeof(data[0])); + std::sort(mDataVec.begin(), mDataVec.end(), Misc::StringUtils::ciLess); + } + + virtual void TearDown() + { + } + + bool matches(const std::string& keyword) + { + return Misc::StringUtils::partialBinarySearch(mDataVec.begin(), mDataVec.end(), keyword) != mDataVec.end(); + } +}; + +TEST_F(PartialBinarySearchTest, partial_binary_search_test) +{ + EXPECT_TRUE( matches("Head 01") ); + EXPECT_TRUE( matches("Head") ); + EXPECT_TRUE( matches("Tri Head 01") ); + EXPECT_TRUE( matches("Tri Head") ); + EXPECT_TRUE( matches("tri head") ); + + EXPECT_FALSE( matches(" Head") ); + EXPECT_FALSE( matches("Tri Head") ); +} + +TEST_F (PartialBinarySearchTest, ci_test) +{ + EXPECT_TRUE (Misc::StringUtils::lowerCase("ASD") == "asd"); + + // test to make sure system locale is not used + std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE CYRILLIC CAPITAL LETTER I + EXPECT_TRUE( Misc::StringUtils::lowerCase(unicode1) == unicode1 ); +} diff --git a/components/misc/stringops.hpp b/components/misc/stringops.hpp index b14051a81..9acd81710 100644 --- a/components/misc/stringops.hpp +++ b/components/misc/stringops.hpp @@ -114,6 +114,30 @@ public: return ciLess(left, right); } }; + + + /// Performs a binary search on a sorted container for a string that 'key' starts with + template + static Iterator partialBinarySearch(Iterator begin, Iterator end, const T& key) + { + const Iterator notFound = end; + + while(begin < end) + { + const Iterator middle = begin + (std::distance(begin, end) / 2); + + int comp = Misc::StringUtils::ciCompareLen((*middle), key, (*middle).size()); + + if(comp == 0) + return middle; + else if(comp > 0) + end = middle; + else + begin = middle + 1; + } + + return notFound; + } }; } diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 167ab6221..ba8c57c1b 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -383,18 +383,25 @@ namespace Resource public: bool isReservedName(const std::string& name) const { - static std::set reservedNames; + if (name.empty()) + return false; + + static std::vector reservedNames; if (reservedNames.empty()) { const char* reserved[] = {"Head", "Neck", "Chest", "Groin", "Right Hand", "Left Hand", "Right Wrist", "Left Wrist", "Shield Bone", "Right Forearm", "Left Forearm", "Right Upper Arm", "Left Upper Arm", "Right Foot", "Left Foot", "Right Ankle", "Left Ankle", "Right Knee", "Left Knee", "Right Upper Leg", "Left Upper Leg", "Right Clavicle", "Left Clavicle", "Weapon Bone", "Tail", "Bip01 L Hand", "Bip01 R Hand", "Bip01 Head", "Bip01 Spine1", "Bip01 Spine2", "Bip01 L Clavicle", "Bip01 R Clavicle", "bip01", "Root Bone", "Bip01 Neck", "BoneOffset", "AttachLight", "ArrowBone", "Camera"}; - reservedNames = std::set(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); + reservedNames = std::vector(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); for (unsigned int i=0; i::iterator it = Misc::StringUtils::partialBinarySearch(reservedNames.begin(), reservedNames.end(), name); + return it != reservedNames.end(); } virtual bool isOperationPermissibleForObjectImplementation(const SceneUtil::Optimizer* optimizer, const osg::Drawable* node,unsigned int option) const From 48c764a580830757e83e5b91c1fbb4fe149114cc Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 May 2017 23:31:06 +0200 Subject: [PATCH 6/8] Update test --- apps/openmw_test_suite/misc/test_stringops.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp index c47e49724..3a3fe295c 100644 --- a/apps/openmw_test_suite/misc/test_stringops.cpp +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -30,6 +30,7 @@ TEST_F(PartialBinarySearchTest, partial_binary_search_test) EXPECT_TRUE( matches("Tri Head") ); EXPECT_TRUE( matches("tri head") ); + EXPECT_FALSE( matches("Hea") ); EXPECT_FALSE( matches(" Head") ); EXPECT_FALSE( matches("Tri Head") ); } From de14e9811dda62f8d164c7f4721ff7738cb676c3 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 8 May 2017 11:16:03 +0400 Subject: [PATCH 7/8] Fixed Travis CI build --- apps/openmw_test_suite/misc/test_stringops.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw_test_suite/misc/test_stringops.cpp b/apps/openmw_test_suite/misc/test_stringops.cpp index 3a3fe295c..53a33dbf4 100644 --- a/apps/openmw_test_suite/misc/test_stringops.cpp +++ b/apps/openmw_test_suite/misc/test_stringops.cpp @@ -40,6 +40,6 @@ TEST_F (PartialBinarySearchTest, ci_test) EXPECT_TRUE (Misc::StringUtils::lowerCase("ASD") == "asd"); // test to make sure system locale is not used - std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE CYRILLIC CAPITAL LETTER I + std::string unicode1 = "\u04151 \u0418"; // CYRILLIC CAPITAL LETTER IE, CYRILLIC CAPITAL LETTER I EXPECT_TRUE( Misc::StringUtils::lowerCase(unicode1) == unicode1 ); } From 315ad54b29c9e0382db26e541b42940dfff1fa5f Mon Sep 17 00:00:00 2001 From: Allofich Date: Mon, 8 May 2017 19:55:54 +0900 Subject: [PATCH 8/8] Don't make NPCs or player speak while underwater (Fixes #3851) --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index c853efad2..38ad821cd 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -633,6 +633,12 @@ namespace MWDialogue return; } + if (actor.getClass().isNpc() && MWBase::Environment::get().getWorld()->isSwimming(actor)) + { + // NPCs don't talk while submerged + return; + } + const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Dialogue *dial = store.get().find(topic);