Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/OpenMW/openmw into osg
Browse files Browse the repository at this point in the history
Conflicts:
	apps/opencs/CMakeLists.txt
	extern/ogre-ffmpeg-videoplayer/CMakeLists.txt
  • Loading branch information
scrawl committed Jun 16, 2015
2 parents b739470 + 62c5f18 commit 3663511
Show file tree
Hide file tree
Showing 22 changed files with 416 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ before_script:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ./CI/before_script.osx.sh; fi
script:
- cd ./build
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j4; fi
- if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then ${ANALYZE}make -j2; fi
- if [ "$COVERITY_SCAN_BRANCH" != 1 ] && [ "${TRAVIS_OS_NAME}" = "osx" ]; then make package; fi
after_script:
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
Expand Down
6 changes: 6 additions & 0 deletions apps/launcher/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ target_link_libraries(openmw-launcher

if (DESIRED_QT_VERSION MATCHES 4)
target_link_libraries(openmw-launcher ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
if(WIN32)
target_link_libraries(openmw-launcher ${QT_QTMAIN_LIBRARY})
endif(WIN32)
else()
qt5_use_modules(openmw-launcher Widgets Core)
if (WIN32)
target_link_libraries(Qt5::WinMain)
endif()
endif()

if (BUILD_WITH_CODE_COVERAGE)
Expand Down
7 changes: 3 additions & 4 deletions apps/launcher/maindialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ bool Launcher::MainDialog::writeSettings()
// Game settings
QFile file(userPath + QString("openmw.cfg"));

if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate)) {
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// File cannot be opened or created
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error writing OpenMW configuration file"));
Expand All @@ -503,10 +503,8 @@ bool Launcher::MainDialog::writeSettings()
return false;
}

QTextStream stream(&file);
stream.setCodec(QTextCodec::codecForName("UTF-8"));

mGameSettings.writeFile(stream);
mGameSettings.writeFileWithComments(file);
file.close();

// Graphics settings
Expand All @@ -525,6 +523,7 @@ bool Launcher::MainDialog::writeSettings()
return false;
}

QTextStream stream(&file);
stream.setDevice(&file);
stream.setCodec(QTextCodec::codecForName("UTF-8"));

Expand Down
9 changes: 8 additions & 1 deletion apps/opencs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ opencs_units (model/tools
opencs_units_noqt (model/tools
mandatoryid skillcheck classcheck factioncheck racecheck soundcheck regioncheck
birthsigncheck spellcheck referencecheck referenceablecheck scriptcheck bodypartcheck
startscriptcheck search searchoperation searchstage pathgridcheck
startscriptcheck search searchoperation searchstage pathgridcheck soundgencheck
)


Expand Down Expand Up @@ -211,8 +211,15 @@ if (DESIRED_QT_VERSION MATCHES 4)
${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTOPENGL_LIBRARY})

if (WIN32)
target_link_libraries(openmw-cs ${QT_QTMAIN_LIBRARY})
endif()
else()
qt5_use_modules(openmw-cs Widgets Core Network OpenGL)
if (WIN32)
target_link_libraries(Qt5::WinMain)
endif()
endif()

if (WIN32)
Expand Down
14 changes: 12 additions & 2 deletions apps/opencs/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void CS::Editor::setupDataFiles (const Files::PathContainer& dataDirs)
}
}

std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfig()
std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfig(bool quiet)
{
boost::program_options::variables_map variables;
boost::program_options::options_description desc("Syntax: openmw-cs <options>\nAllowed options");
Expand All @@ -106,7 +106,7 @@ std::pair<Files::PathContainer, std::vector<std::string> > CS::Editor::readConfi

boost::program_options::notify(variables);

mCfgMgr.readConfiguration(variables, desc);
mCfgMgr.readConfiguration(variables, desc, quiet);

mDocumentManager.setEncoding (
ToUTF8::calculateEncoding (variables["encoding"].as<std::string>()));
Expand Down Expand Up @@ -186,6 +186,11 @@ void CS::Editor::cancelCreateGame()
void CS::Editor::createAddon()
{
mStartup.hide();

mFileDialog.clearFiles();
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(/*quiet*/true);
setupDataFiles (config.first);

mFileDialog.showDialog (CSVDoc::ContentAction_New);
}

Expand All @@ -206,6 +211,11 @@ void CS::Editor::cancelFileDialog()
void CS::Editor::loadDocument()
{
mStartup.hide();

mFileDialog.clearFiles();
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(/*quiet*/true);
setupDataFiles (config.first);

mFileDialog.showDialog (CSVDoc::ContentAction_Edit);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/opencs/editor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace CS

void setupDataFiles (const Files::PathContainer& dataDirs);

std::pair<Files::PathContainer, std::vector<std::string> > readConfig();
std::pair<Files::PathContainer, std::vector<std::string> > readConfig(bool quiet=false);
///< \return data paths

// not implemented
Expand Down
53 changes: 53 additions & 0 deletions apps/opencs/model/tools/soundgencheck.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "soundgencheck.hpp"

#include <sstream>

#include "../world/refiddata.hpp"
#include "../world/universalid.hpp"

CSMTools::SoundGenCheckStage::SoundGenCheckStage(const CSMWorld::IdCollection<ESM::SoundGenerator> &soundGens,
const CSMWorld::IdCollection<ESM::Sound> &sounds,
const CSMWorld::RefIdCollection &referenceables)
: mSoundGens(soundGens),
mSounds(sounds),
mReferenceables(referenceables)
{}

int CSMTools::SoundGenCheckStage::setup()
{
return mSoundGens.getSize();
}

void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages)
{
const CSMWorld::Record<ESM::SoundGenerator> &record = mSoundGens.getRecord(stage);
if (record.isDeleted())
{
return;
}

const ESM::SoundGenerator soundGen = record.get();
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_SoundGen, soundGen.mId);

if (!soundGen.mCreature.empty())
{
CSMWorld::RefIdData::LocalIndex creatureIndex = mReferenceables.getDataSet().searchId(soundGen.mCreature);
if (creatureIndex.first == -1)
{
messages.push_back(std::make_pair(id, "No such creature '" + soundGen.mCreature + "'"));
}
else if (creatureIndex.second != CSMWorld::UniversalId::Type_Creature)
{
messages.push_back(std::make_pair(id, "'" + soundGen.mCreature + "' is not a creature"));
}
}

if (soundGen.mSound.empty())
{
messages.push_back(std::make_pair(id, "Sound is not specified"));
}
else if (mSounds.searchId(soundGen.mSound) == -1)
{
messages.push_back(std::make_pair(id, "No such sound '" + soundGen.mSound + "'"));
}
}
30 changes: 30 additions & 0 deletions apps/opencs/model/tools/soundgencheck.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef CSM_TOOLS_SOUNDGENCHECK_HPP
#define CSM_TOOLS_SOUNDGENCHECK_HPP

#include "../world/data.hpp"

#include "../doc/stage.hpp"

namespace CSMTools
{
/// \brief VerifyStage: make sure that sound gen records are internally consistent
class SoundGenCheckStage : public CSMDoc::Stage
{
const CSMWorld::IdCollection<ESM::SoundGenerator> &mSoundGens;
const CSMWorld::IdCollection<ESM::Sound> &mSounds;
const CSMWorld::RefIdCollection &mReferenceables;

public:
SoundGenCheckStage(const CSMWorld::IdCollection<ESM::SoundGenerator> &soundGens,
const CSMWorld::IdCollection<ESM::Sound> &sounds,
const CSMWorld::RefIdCollection &referenceables);

virtual int setup();
///< \return number of steps

virtual void perform(int stage, CSMDoc::Messages &messages);
///< Messages resulting from this stage will be appended to \a messages.
};
}

#endif
5 changes: 5 additions & 0 deletions apps/opencs/model/tools/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "startscriptcheck.hpp"
#include "searchoperation.hpp"
#include "pathgridcheck.hpp"
#include "soundgencheck.hpp"

CSMDoc::OperationHolder *CSMTools::Tools::get (int type)
{
Expand Down Expand Up @@ -99,6 +100,10 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()

mVerifierOperation->appendStage (new PathgridCheckStage (mData.getPathgrids()));

mVerifierOperation->appendStage (new SoundGenCheckStage (mData.getSoundGens(),
mData.getSounds(),
mData.getReferenceables()));

mVerifier.setOperation (mVerifierOperation);
}

Expand Down
8 changes: 6 additions & 2 deletions apps/opencs/view/doc/filedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ void CSVDoc::FileDialog::addFiles(const QString &path)
mSelector->addFiles(path);
}

void CSVDoc::FileDialog::clearFiles()
{
mSelector->clearFiles();
}

QStringList CSVDoc::FileDialog::selectedFilePaths()
{
QStringList filePaths;
Expand Down Expand Up @@ -105,7 +110,6 @@ void CSVDoc::FileDialog::buildNewFileView()

connect (mFileWidget, SIGNAL (nameChanged(const QString &, bool)),
this, SLOT (slotUpdateAcceptButton(const QString &, bool)));

}

ui.projectGroupBoxLayout->insertWidget (0, mFileWidget);
Expand Down Expand Up @@ -139,7 +143,7 @@ void CSVDoc::FileDialog::slotUpdateAcceptButton(int)
{
QString name = "";

if (mAction == ContentAction_New)
if (mFileWidget && mAction == ContentAction_New)
name = mFileWidget->getName();

slotUpdateAcceptButton (name, true);
Expand Down
1 change: 1 addition & 0 deletions apps/opencs/view/doc/filedialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace CSVDoc
void showDialog (ContentAction action);

void addFiles (const QString &path);
void clearFiles ();

QString filename() const;
QStringList selectedFilePaths();
Expand Down
6 changes: 6 additions & 0 deletions apps/openmw/mwmechanics/aiwander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ namespace MWMechanics
if (mAllowedNodes.empty())
return;

if (actor.getClass().isPureWaterCreature(actor))
return;

state.moveIn(new AiWanderStorage());

int index = Misc::Rng::rollDice(mAllowedNodes.size());
Expand All @@ -659,6 +662,9 @@ namespace MWMechanics
MWBase::Environment::get().getWorld()->moveObject(actor, static_cast<float>(dest.mX),
static_cast<float>(dest.mY), static_cast<float>(dest.mZ));
actor.getClass().adjustPosition(actor, false);

// may have changed cell
mStoredAvailableNodes = false;
}

void AiWander::getAllowedNodes(const MWWorld::Ptr& actor, const ESM::Cell* cell)
Expand Down
7 changes: 7 additions & 0 deletions apps/wizard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,15 @@ if (DESIRED_QT_VERSION MATCHES 4)
target_link_libraries(openmw-wizard
${QT_QTGUI_LIBRARY}
${QT_QTCORE_LIBRARY})

if (WIN32)
target_link_libraries(openmw-wizard ${QT_QTMAIN_LIBRARY})
endif()
else()
qt5_use_modules(openmw-wizard Widgets Core)
if (WIN32)
target_link_libraries(Qt5::WinMain)
endif()
endif()

if (OPENMW_USE_UNSHIELD)
Expand Down
Loading

0 comments on commit 3663511

Please sign in to comment.