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"
|
|
|
|
|
2013-04-06 19:48:52 +00:00
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
|
|
|
|
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds)
|
|
|
|
: mSounds (sounds)
|
2018-06-19 22:20:03 +00:00
|
|
|
{
|
|
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
}
|
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
|
|
|
|
if ((mIgnoreBaseRecords && record.isBaseOnly()) || 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
|
|
|
|
|
|
|
/// \todo check, if the sound file exists
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|