Add check for an empty sound field to SoundGens verifier

c++11
Stanislav Bas 10 years ago
parent 2c15ad5e0c
commit 281088c93b

@ -29,7 +29,7 @@ void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages
const ESM::SoundGenerator soundGen = record.get(); const ESM::SoundGenerator soundGen = record.get();
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_SoundGen, soundGen.mId); CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_SoundGen, soundGen.mId);
if (soundGen.mCreature != "") if (!soundGen.mCreature.empty())
{ {
CSMWorld::RefIdData::LocalIndex creatureIndex = mReferenceables.getDataSet().searchId(soundGen.mCreature); CSMWorld::RefIdData::LocalIndex creatureIndex = mReferenceables.getDataSet().searchId(soundGen.mCreature);
if (creatureIndex.first == -1) if (creatureIndex.first == -1)
@ -42,7 +42,11 @@ void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages
} }
} }
if (mSounds.searchId(soundGen.mSound) == -1) 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 + "'")); messages.push_back(std::make_pair(id, "No such sound '" + soundGen.mSound + "'"));
} }

Loading…
Cancel
Save