1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/opencs/model/tools/soundcheck.cpp

50 lines
1.5 KiB
C++
Raw Normal View History

2013-04-06 21:48:52 +02:00
#include "soundcheck.hpp"
#include <components/esm/loadskil.hpp>
#include "../prefs/state.hpp"
2013-04-06 21:48:52 +02:00
#include "../world/universalid.hpp"
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound> &sounds,
const CSMWorld::Resources &soundfiles)
: mSounds (sounds),
mSoundFiles (soundfiles)
{
mIgnoreBaseRecords = false;
}
2013-04-06 21:48:52 +02:00
int CSMTools::SoundCheckStage::setup()
{
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
2013-04-06 21:48:52 +02:00
return mSounds.getSize();
}
void CSMTools::SoundCheckStage::perform (int stage, CSMDoc::Messages& messages)
2013-04-06 21:48:52 +02:00
{
2013-09-27 10:08:09 +02:00
const CSMWorld::Record<ESM::Sound>& record = mSounds.getRecord (stage);
// Skip "Base" records (setting!) and "Deleted" records
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
2013-09-27 10:08:09 +02:00
return;
const ESM::Sound& sound = record.get();
2013-04-06 21:48:52 +02:00
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Sound, sound.mId);
if (sound.mData.mMinRange>sound.mData.mMaxRange)
{
messages.add(id, "Minimum range larger than maximum range", "", CSMDoc::Message::Severity_Warning);
}
2013-04-06 21:48:52 +02:00
if (sound.mSound.empty())
{
messages.add(id, "Sound file is missing", "", CSMDoc::Message::Severity_Error);
}
else if (mSoundFiles.searchId(sound.mSound) == -1)
{
messages.add(id, "Sound file '" + sound.mSound + "' does not exist", "", CSMDoc::Message::Severity_Error);
}
2015-03-11 10:54:45 -04:00
}