1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-24 08:41:37 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Marc Zinnschlag 2017-05-12 14:48:03 +02:00
commit 6906e35ac0
8 changed files with 102 additions and 19 deletions

View file

@ -305,11 +305,11 @@ if [ -z $SKIP_DOWNLOAD ]; then
"Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z" "Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z"
# FFmpeg # FFmpeg
download "FFmpeg 3.0.1" \ download "FFmpeg 3.2.4" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.0.1-win${BITS}-shared.7z" \ "http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.zip" \
"ffmpeg-3.0.1-win${BITS}.7z" \ "ffmpeg-3.2.4-win${BITS}.zip" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.0.1-win${BITS}-dev.7z" \ "http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.zip" \
"ffmpeg-3.0.1-dev-win${BITS}.7z" "ffmpeg-3.2.4-dev-win${BITS}.zip"
# MyGUI # MyGUI
download "MyGUI 3.2.3-git" \ download "MyGUI 3.2.3-git" \
@ -434,21 +434,21 @@ cd $DEPS
echo echo
# FFmpeg # FFmpeg
printf "FFmpeg 3.0.1... " printf "FFmpeg 3.2.4... "
{ {
cd $DEPS_INSTALL 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. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf FFmpeg rm -rf FFmpeg
eval 7z x -y "${DEPS}/ffmpeg-3.0.1-win${BITS}.7z" $STRIP eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.zip" $STRIP
eval 7z x -y "${DEPS}/ffmpeg-3.0.1-dev-win${BITS}.7z" $STRIP eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.zip" $STRIP
mv "ffmpeg-3.0.1-win${BITS}-shared" FFmpeg mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg
cp -r "ffmpeg-3.0.1-win${BITS}-dev/"* FFmpeg/ cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/
rm -rf "ffmpeg-3.0.1-win${BITS}-dev" rm -rf "ffmpeg-3.2.4-win${BITS}-dev"
fi fi
export FFMPEG_HOME="$(real_pwd)/FFmpeg" export FFMPEG_HOME="$(real_pwd)/FFmpeg"
@ -755,4 +755,4 @@ if [ -z $CI ]; then
echo echo
fi fi
exit $RET exit $RET

View file

@ -633,6 +633,12 @@ namespace MWDialogue
return; 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 MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Dialogue *dial = store.get<ESM::Dialogue>().find(topic); const ESM::Dialogue *dial = store.get<ESM::Dialogue>().find(topic);

View file

@ -259,7 +259,7 @@ namespace MWSound
float basevol = volumeFromType(Play_TypeVoice); float basevol = volumeFromType(Play_TypeVoice);
if(playlocal) 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); mOutput->streamSound(decoder, sound);
} }
else else

View file

@ -938,7 +938,6 @@ void MWWorld::InventoryStore::purgeEffect(short effectId, const std::string &sou
mMagicEffects.add (*effectIt, -magnitude); mMagicEffects.add (*effectIt, -magnitude);
params[i].mMultiplier = 0; params[i].mMultiplier = 0;
break;
} }
} }
} }

View file

@ -11,6 +11,8 @@ if (GTEST_FOUND)
mwdialogue/test_keywordsearch.cpp mwdialogue/test_keywordsearch.cpp
esm/test_fixed_string.cpp esm/test_fixed_string.cpp
misc/test_stringops.cpp
) )
source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES}) source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES})

View file

@ -0,0 +1,45 @@
#include <gtest/gtest.h>
#include "components/misc/stringops.hpp"
struct PartialBinarySearchTest : public ::testing::Test
{
protected:
std::vector<std::string> mDataVec;
virtual void SetUp()
{
const char* data[] = { "Head", "Chest", "Tri Head", "Tri Chest", "Bip01" };
mDataVec = std::vector<std::string>(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("Hea") );
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 );
}

View file

@ -114,6 +114,30 @@ public:
return ciLess(left, right); return ciLess(left, right);
} }
}; };
/// Performs a binary search on a sorted container for a string that 'key' starts with
template<typename Iterator, typename T>
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;
}
}; };
} }

View file

@ -383,18 +383,25 @@ namespace Resource
public: public:
bool isReservedName(const std::string& name) const bool isReservedName(const std::string& name) const
{ {
static std::set<std::string, Misc::StringUtils::CiComp> reservedNames; if (name.empty())
return false;
static std::vector<std::string> reservedNames;
if (reservedNames.empty()) 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", 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", "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"}; "BoneOffset", "AttachLight", "ArrowBone", "Camera"};
reservedNames = std::set<std::string, Misc::StringUtils::CiComp>(reserved, reserved + sizeof(reserved)/sizeof(reserved[0])); reservedNames = std::vector<std::string>(reserved, reserved + sizeof(reserved)/sizeof(reserved[0]));
for (unsigned int i=0; i<sizeof(reserved)/sizeof(reserved[0]); ++i) for (unsigned int i=0; i<sizeof(reserved)/sizeof(reserved[0]); ++i)
reservedNames.insert(std::string("Tri ") + reserved[i]); reservedNames.push_back(std::string("Tri ") + reserved[i]);
std::sort(reservedNames.begin(), reservedNames.end(), Misc::StringUtils::ciLess);
} }
return reservedNames.find(name) != reservedNames.end();
std::vector<std::string>::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 virtual bool isOperationPermissibleForObjectImplementation(const SceneUtil::Optimizer* optimizer, const osg::Drawable* node,unsigned int option) const