diff --git a/apps/opencs/model/doc/saving.cpp b/apps/opencs/model/doc/saving.cpp index 9c6932941f..9a67a2683f 100644 --- a/apps/opencs/model/doc/saving.cpp +++ b/apps/opencs/model/doc/saving.cpp @@ -72,6 +72,9 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje appendStage (new WriteCollectionStage > (mDocument.getData().getBodyParts(), mState)); + appendStage (new WriteCollectionStage > + (mDocument.getData().getSoundGens(), mState)); + appendStage (new WriteDialogueCollectionStage (mDocument, mState, false)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, true)); diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index bb4fa0b436..f349e15dd7 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -539,6 +539,16 @@ CSMWorld::IdCollection& CSMWorld::Data::getDebugProfiles() return mDebugProfiles; } +const CSMWorld::IdCollection& CSMWorld::Data::getSoundGens() const +{ + return mSoundGens; +} + +CSMWorld::IdCollection& CSMWorld::Data::getSoundGens() +{ + return mSoundGens; +} + const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const { return mResourcesManager.get (id.getType()); @@ -625,6 +635,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages) case ESM::REC_SPEL: mSpells.load (*mReader, mBase); break; case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break; case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break; + case ESM::REC_SNDG: mSoundGens.load (*mReader, mBase); break; case ESM::REC_CELL: { @@ -775,6 +786,7 @@ bool CSMWorld::Data::hasId (const std::string& id) const getCells().searchId (id)!=-1 || getEnchantments().searchId (id)!=-1 || getBodyParts().searchId (id)!=-1 || + getSoundGens().searchId (id)!=-1 || getReferenceables().searchId (id)!=-1; } @@ -795,6 +807,7 @@ int CSMWorld::Data::count (RecordBase::State state) const count (state, mCells) + count (state, mEnchantments) + count (state, mBodyParts) + + count (state, mSoundGens) + count (state, mReferenceables); } @@ -837,6 +850,7 @@ std::vector CSMWorld::Data::getIds (bool listDeleted) const appendIds (ids, mCells, listDeleted); appendIds (ids, mEnchantments, listDeleted); appendIds (ids, mBodyParts, listDeleted); + appendIds (ids, mSoundGens, listDeleted); appendIds (ids, mReferenceables, listDeleted); std::sort (ids.begin(), ids.end()); diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index d0a07c6777..d5f78bb1e9 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -71,6 +72,7 @@ namespace CSMWorld IdCollection mEnchantments; IdCollection mBodyParts; IdCollection mDebugProfiles; + IdCollection mSoundGens; InfoCollection mTopicInfos; InfoCollection mJournalInfos; IdCollection mCells; @@ -195,6 +197,10 @@ namespace CSMWorld IdCollection& getDebugProfiles(); + const IdCollection& getSoundGens() const; + + IdCollection& getSoundGens(); + /// Throws an exception, if \a id does not match a resources list. const Resources& getResources (const UniversalId& id) const; diff --git a/apps/opencs/model/world/universalid.cpp b/apps/opencs/model/world/universalid.cpp index 816dbc4fbc..948c61894c 100644 --- a/apps/opencs/model/world/universalid.cpp +++ b/apps/opencs/model/world/universalid.cpp @@ -52,6 +52,7 @@ namespace { CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 }, { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_DebugProfiles, "Debug Profiles", 0 }, { CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_RunLog, "Run Log", 0 }, + { CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_SoundGens, "Sound Gens", 0 }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker }; @@ -112,6 +113,7 @@ namespace { CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Texture, "Texture", 0 }, { CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Video, "Video", 0 }, { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_DebugProfile, "Debug Profile", 0 }, + { CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_SoundGen, "Sound Gen", 0 }, { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker }; diff --git a/apps/opencs/model/world/universalid.hpp b/apps/opencs/model/world/universalid.hpp index 069beed4b1..3d18d69ea0 100644 --- a/apps/opencs/model/world/universalid.hpp +++ b/apps/opencs/model/world/universalid.hpp @@ -122,10 +122,12 @@ namespace CSMWorld Type_Video, Type_DebugProfiles, Type_DebugProfile, + Type_SoundGens, + Type_SoundGen, Type_RunLog }; - enum { NumberOfTypes = Type_DebugProfile+1 }; + enum { NumberOfTypes = Type_RunLog+1 }; private: diff --git a/components/esm/loadsndg.cpp b/components/esm/loadsndg.cpp index 1a8ca63354..9ab061ec25 100644 --- a/components/esm/loadsndg.cpp +++ b/components/esm/loadsndg.cpp @@ -22,4 +22,10 @@ void SoundGenerator::save(ESMWriter &esm) const esm.writeHNOCString("SNAM", mSound); } + void SoundGenerator::blank() + { + mType = LeftFoot; + mCreature.clear(); + mSound.clear(); + } } diff --git a/components/esm/loadsndg.hpp b/components/esm/loadsndg.hpp index 5509661c18..f89a112082 100644 --- a/components/esm/loadsndg.hpp +++ b/components/esm/loadsndg.hpp @@ -36,6 +36,8 @@ struct SoundGenerator void load(ESMReader &esm); void save(ESMWriter &esm) const; + + void blank(); }; } #endif