2013-04-06 19:48:52 +00:00
|
|
|
#include "soundcheck.hpp"
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <components/esm/loadskil.hpp>
|
|
|
|
|
2018-06-19 22:20:03 +00:00
|
|
|
#include "../prefs/state.hpp"
|
|
|
|
|
2018-08-24 21:47:38 +00:00
|
|
|
#include "../world/data.hpp"
|
|
|
|
#include "../world/resources.hpp"
|
2013-04-06 19:48:52 +00:00
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
|
2018-08-24 21:47:38 +00:00
|
|
|
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound> &sounds,
|
|
|
|
const CSMWorld::Resources &soundfiles)
|
|
|
|
: mSounds (sounds),
|
|
|
|
mSoundFiles (soundfiles)
|
2018-06-19 22:20:03 +00:00
|
|
|
{
|
2018-06-20 09:29:38 +00:00
|
|
|
mIgnoreBaseRecords = false;
|
2018-06-19 22:20:03 +00:00
|
|
|
}
|
2013-04-06 19:48:52 +00:00
|
|
|
|
|
|
|
int CSMTools::SoundCheckStage::setup()
|
|
|
|
{
|
2018-06-19 22:20:03 +00:00
|
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
|
2013-04-06 19:48:52 +00:00
|
|
|
return mSounds.getSize();
|
|
|
|
}
|
|
|
|
|
2014-12-07 17:57:47 +00:00
|
|
|
void CSMTools::SoundCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
2013-04-06 19:48:52 +00:00
|
|
|
{
|
2013-09-27 08:08:09 +00:00
|
|
|
const CSMWorld::Record<ESM::Sound>& record = mSounds.getRecord (stage);
|
|
|
|
|
2018-06-19 22:20:03 +00:00
|
|
|
// Skip "Base" records (setting!) and "Deleted" records
|
2018-06-20 09:29:38 +00:00
|
|
|
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
2013-09-27 08:08:09 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
const ESM::Sound& sound = record.get();
|
2013-04-06 19:48:52 +00:00
|
|
|
|
|
|
|
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Sound, sound.mId);
|
|
|
|
|
|
|
|
if (sound.mData.mMinRange>sound.mData.mMaxRange)
|
2018-05-05 21:13:09 +00:00
|
|
|
messages.push_back (std::make_pair (id, "Minimum range larger than maximum range"));
|
2013-04-06 19:48:52 +00:00
|
|
|
|
2018-08-24 21:47:38 +00:00
|
|
|
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"));
|
|
|
|
}
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|