From 697b809c794cd6507b8c35cccd440785bd69266f Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 6 Mar 2016 14:49:34 +0100 Subject: [PATCH 1/4] Reactivate OS X CI --- .travis.yml | 3 ++- CI/before_install.osx.sh | 13 +++++++------ CI/before_script.osx.sh | 22 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index e314d8e7b..839dbccd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ os: - linux -# - osx + - osx +osx_image: xcode7.2 language: cpp sudo: required dist: trusty diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index 8bfe2b70f..b9da52193 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -1,9 +1,10 @@ #!/bin/sh -export CXX=clang++ -export CC=clang - -brew tap openmw/openmw brew update -brew unlink boost -brew install openmw-mygui openmw-bullet openmw-sdl2 openmw-ffmpeg openmw/openmw/qt unshield +brew rm cmake || true +brew rm pkgconfig || true +brew rm qt5 || true +brew install cmake pkgconfig qt5 + +curl http://downloads.openmw.org/osx/dependencies/openmw-deps-263d4a8.zip -o ~/openmw-deps.zip +unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index 772284f91..bf38186f6 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -1,5 +1,25 @@ #!/bin/sh +export CXX=clang++ +export CC=clang + +DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps" +QT_PATH="/usr/local/opt/qt5" + mkdir build cd build -cmake -DCMAKE_FRAMEWORK_PATH="/usr/local/lib/macosx/Release" -DCMAKE_EXE_LINKER_FLAGS="-F/usr/local/lib/macosx/Release" -DCMAKE_CXX_FLAGS="-stdlib=libstdc++" -DCMAKE_BUILD_TYPE=Debug -DBUILD_MYGUI_PLUGIN=OFF -G"Unix Makefiles" .. + +cmake \ +-D PKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON \ +-D CMAKE_EXE_LINKER_FLAGS="-lz" \ +-D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \ +-D CMAKE_OSX_DEPLOYMENT_TARGET="10.8" \ +-D CMAKE_OSX_SYSROOT="macosx10.11" \ +-D CMAKE_BUILD_TYPE=Debug \ +-D OPENMW_OSX_DEPLOYMENT=TRUE \ +-D DESIRED_QT_VERSION=5 \ +-D OSG_PLUGIN_LIB_SEARCH_PATH="$DEPENDENCIES_ROOT/lib/osgPlugins-3.4.0" \ +-D BUILD_ESMTOOL=FALSE \ +-D BUILD_MYGUI_PLUGIN=FALSE \ +-G"Unix Makefiles" \ +.. From d0aba0d9ee0453f213cdcb6111dc24f86c725e4b Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 7 Mar 2016 21:28:50 +0100 Subject: [PATCH 2/4] Catch exceptions thrown during reference loading (Bug #3238) --- apps/openmw/mwworld/cellstore.cpp | 80 ++++++++++++++++++------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 13f74e22b..821c7035d 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -463,27 +463,34 @@ namespace MWWorld // Load references from all plugins that do something with this cell. for (size_t i = 0; i < mCell->mContextList.size(); i++) { - // Reopen the ESM reader and seek to the right position. - int index = mCell->mContextList.at(i).index; - mCell->restore (esm[index], i); + try + { + // Reopen the ESM reader and seek to the right position. + int index = mCell->mContextList.at(i).index; + mCell->restore (esm[index], i); - ESM::CellRef ref; + ESM::CellRef ref; - // Get each reference in turn - bool deleted = false; - while (mCell->getNextRef (esm[index], ref, deleted)) - { - if (deleted) - continue; + // Get each reference in turn + bool deleted = false; + while (mCell->getNextRef (esm[index], ref, deleted)) + { + if (deleted) + continue; - // Don't list reference if it was moved to a different cell. - ESM::MovedCellRefTracker::const_iterator iter = - std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum); - if (iter != mCell->mMovedRefs.end()) { - continue; - } + // Don't list reference if it was moved to a different cell. + ESM::MovedCellRefTracker::const_iterator iter = + std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum); + if (iter != mCell->mMovedRefs.end()) { + continue; + } - mIds.push_back (Misc::StringUtils::lowerCase (ref.mRefID)); + mIds.push_back (Misc::StringUtils::lowerCase (ref.mRefID)); + } + } + catch (std::exception& e) + { + std::cerr << "An error occured listing references for cell " << getCell()->getDescription() << ": " << e.what() << std::endl; } } @@ -510,25 +517,32 @@ namespace MWWorld // Load references from all plugins that do something with this cell. for (size_t i = 0; i < mCell->mContextList.size(); i++) { - // Reopen the ESM reader and seek to the right position. - int index = mCell->mContextList.at(i).index; - mCell->restore (esm[index], i); + try + { + // Reopen the ESM reader and seek to the right position. + int index = mCell->mContextList.at(i).index; + mCell->restore (esm[index], i); - ESM::CellRef ref; - ref.mRefNum.mContentFile = ESM::RefNum::RefNum_NoContentFile; + ESM::CellRef ref; + ref.mRefNum.mContentFile = ESM::RefNum::RefNum_NoContentFile; - // Get each reference in turn - bool deleted = false; - while(mCell->getNextRef(esm[index], ref, deleted)) - { - // Don't load reference if it was moved to a different cell. - ESM::MovedCellRefTracker::const_iterator iter = - std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum); - if (iter != mCell->mMovedRefs.end()) { - continue; + // Get each reference in turn + bool deleted = false; + while(mCell->getNextRef(esm[index], ref, deleted)) + { + // Don't load reference if it was moved to a different cell. + ESM::MovedCellRefTracker::const_iterator iter = + std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum); + if (iter != mCell->mMovedRefs.end()) { + continue; + } + + loadRef (ref, deleted); } - - loadRef (ref, deleted); + } + catch (std::exception& e) + { + std::cerr << "An error occured loading references for cell " << getCell()->getDescription() << ": " << e.what() << std::endl; } } From 3e6cf17665465f2e02b55690966f28511160ebed Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 7 Mar 2016 22:39:43 +0100 Subject: [PATCH 3/4] Warn about cellrefs with an empty refId (Bug #3238) --- apps/openmw/mwworld/cellstore.cpp | 4 ++-- components/esm/cellref.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 821c7035d..87a836f71 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -194,7 +194,7 @@ namespace MWWorld else { std::cerr - << "Error: could not resolve cell reference " << ref.mRefID + << "Error: could not resolve cell reference '" << ref.mRefID << "'" << " (dropping reference)" << std::endl; } } @@ -612,7 +612,7 @@ namespace MWWorld case ESM::REC_WEAP: mWeapons.load(ref, deleted, store); break; case ESM::REC_BODY: mBodyParts.load(ref, deleted, store); break; - case 0: std::cerr << "Cell reference " + ref.mRefID + " not found!\n"; break; + case 0: std::cerr << "Cell reference '" + ref.mRefID + "' not found!\n"; break; default: std::cerr diff --git a/components/esm/cellref.cpp b/components/esm/cellref.cpp index 7acaed86d..14fb14dd4 100644 --- a/components/esm/cellref.cpp +++ b/components/esm/cellref.cpp @@ -1,5 +1,7 @@ #include "cellref.hpp" +#include + #include "esmreader.hpp" #include "esmwriter.hpp" @@ -43,7 +45,13 @@ void ESM::CellRef::loadId (ESMReader& esm, bool wideRefNum) mRefNum.load (esm, wideRefNum); - mRefID = esm.getHNString ("NAME"); + mRefID = esm.getHNOString ("NAME"); + if (mRefID.empty()) + { + std::ios::fmtflags f(std::cerr.flags()); + std::cerr << "Warning: got CellRef with empty RefId in " << esm.getName() << " 0x" << std::hex << esm.getFileOffset() << std::endl; + std::cerr.flags(f); + } } void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted) From 121bdd3e39aeff88f017ce79ab92dd398cce954f Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 7 Mar 2016 22:46:15 +0100 Subject: [PATCH 4/4] Update comment --- components/esm/loadcell.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index cab8cf65e..549ed7309 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -30,12 +30,12 @@ class MovedCellRef public: RefNum mRefNum; - // Target cell (if exterior) + // Coordinates of target exterior cell int mTarget[2]; - // TODO: Support moving references between exterior and interior cells! - // This may happen in saves, when an NPC follows the player. Tribunal - // introduces a henchman (which no one uses), so we may need this as well. + // The content file format does not support moving objects to an interior cell. + // The save game format does support moving to interior cells, but uses a different mechanism + // (see the MovedRefTracker implementation in MWWorld::CellStore for more details). }; /// Overloaded compare operator used to search inside a list of cell refs.