1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:53:50 +00:00

Add sound file checks to sound record verifier

This commit is contained in:
Capostrophic 2018-08-25 00:47:38 +03:00
parent 1f717def35
commit 38ea7928f5
3 changed files with 23 additions and 5 deletions

View file

@ -6,10 +6,14 @@
#include "../prefs/state.hpp"
#include "../world/data.hpp"
#include "../world/resources.hpp"
#include "../world/universalid.hpp"
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds)
: mSounds (sounds)
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound> &sounds,
const CSMWorld::Resources &soundfiles)
: mSounds (sounds),
mSoundFiles (soundfiles)
{
mIgnoreBaseRecords = false;
}
@ -36,5 +40,12 @@ void CSMTools::SoundCheckStage::perform (int stage, CSMDoc::Messages& messages)
if (sound.mData.mMinRange>sound.mData.mMaxRange)
messages.push_back (std::make_pair (id, "Minimum range larger than maximum range"));
/// \todo check, if the sound file exists ADD CHECK HERE
if (sound.mSound.empty())
{
messages.push_back(std::make_pair(id, "Sound file is missing"));
}
else if (mSoundFiles.searchId(sound.mSound) == -1)
{
messages.push_back(std::make_pair(id, "Sound file '" + sound.mSound + "' does not exist"));
}
}

View file

@ -7,17 +7,24 @@
#include "../doc/stage.hpp"
namespace CSMWorld
{
class Resources;
}
namespace CSMTools
{
/// \brief VerifyStage: make sure that sound records are internally consistent
class SoundCheckStage : public CSMDoc::Stage
{
const CSMWorld::IdCollection<ESM::Sound>& mSounds;
const CSMWorld::Resources &mSoundFiles;
bool mIgnoreBaseRecords;
public:
SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds);
SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds,
const CSMWorld::Resources &soundfiles);
virtual int setup();
///< \return number of steps

View file

@ -74,7 +74,7 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
mVerifierOperation->appendStage (new RaceCheckStage (mData.getRaces()));
mVerifierOperation->appendStage (new SoundCheckStage (mData.getSounds()));
mVerifierOperation->appendStage (new SoundCheckStage (mData.getSounds(), mData.getResources (CSMWorld::UniversalId::Type_SoundsRes)));
mVerifierOperation->appendStage (new RegionCheckStage (mData.getRegions()));