1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-10 16:14:26 +00:00

load and save sound gen records

This commit is contained in:
Marc Zinnschlag 2014-09-23 12:18:18 +02:00
parent 147bffa7dd
commit 02247fe712
7 changed files with 36 additions and 1 deletions

View File

@ -72,6 +72,9 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> > appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> >
(mDocument.getData().getBodyParts(), mState)); (mDocument.getData().getBodyParts(), mState));
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::SoundGenerator> >
(mDocument.getData().getSoundGens(), mState));
appendStage (new WriteDialogueCollectionStage (mDocument, mState, false)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, false));
appendStage (new WriteDialogueCollectionStage (mDocument, mState, true)); appendStage (new WriteDialogueCollectionStage (mDocument, mState, true));

View File

@ -539,6 +539,16 @@ CSMWorld::IdCollection<ESM::DebugProfile>& CSMWorld::Data::getDebugProfiles()
return mDebugProfiles; return mDebugProfiles;
} }
const CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens() const
{
return mSoundGens;
}
CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens()
{
return mSoundGens;
}
const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
{ {
return mResourcesManager.get (id.getType()); 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_SPEL: mSpells.load (*mReader, mBase); break;
case ESM::REC_ENCH: mEnchantments.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_BODY: mBodyParts.load (*mReader, mBase); break;
case ESM::REC_SNDG: mSoundGens.load (*mReader, mBase); break;
case ESM::REC_CELL: case ESM::REC_CELL:
{ {
@ -775,6 +786,7 @@ bool CSMWorld::Data::hasId (const std::string& id) const
getCells().searchId (id)!=-1 || getCells().searchId (id)!=-1 ||
getEnchantments().searchId (id)!=-1 || getEnchantments().searchId (id)!=-1 ||
getBodyParts().searchId (id)!=-1 || getBodyParts().searchId (id)!=-1 ||
getSoundGens().searchId (id)!=-1 ||
getReferenceables().searchId (id)!=-1; getReferenceables().searchId (id)!=-1;
} }
@ -795,6 +807,7 @@ int CSMWorld::Data::count (RecordBase::State state) const
count (state, mCells) + count (state, mCells) +
count (state, mEnchantments) + count (state, mEnchantments) +
count (state, mBodyParts) + count (state, mBodyParts) +
count (state, mSoundGens) +
count (state, mReferenceables); count (state, mReferenceables);
} }
@ -837,6 +850,7 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
appendIds (ids, mCells, listDeleted); appendIds (ids, mCells, listDeleted);
appendIds (ids, mEnchantments, listDeleted); appendIds (ids, mEnchantments, listDeleted);
appendIds (ids, mBodyParts, listDeleted); appendIds (ids, mBodyParts, listDeleted);
appendIds (ids, mSoundGens, listDeleted);
appendIds (ids, mReferenceables, listDeleted); appendIds (ids, mReferenceables, listDeleted);
std::sort (ids.begin(), ids.end()); std::sort (ids.begin(), ids.end());

View File

@ -23,6 +23,7 @@
#include <components/esm/loaddial.hpp> #include <components/esm/loaddial.hpp>
#include <components/esm/loadench.hpp> #include <components/esm/loadench.hpp>
#include <components/esm/loadbody.hpp> #include <components/esm/loadbody.hpp>
#include <components/esm/loadsndg.hpp>
#include <components/esm/debugprofile.hpp> #include <components/esm/debugprofile.hpp>
#include <components/esm/filter.hpp> #include <components/esm/filter.hpp>
@ -71,6 +72,7 @@ namespace CSMWorld
IdCollection<ESM::Enchantment> mEnchantments; IdCollection<ESM::Enchantment> mEnchantments;
IdCollection<ESM::BodyPart> mBodyParts; IdCollection<ESM::BodyPart> mBodyParts;
IdCollection<ESM::DebugProfile> mDebugProfiles; IdCollection<ESM::DebugProfile> mDebugProfiles;
IdCollection<ESM::SoundGenerator> mSoundGens;
InfoCollection mTopicInfos; InfoCollection mTopicInfos;
InfoCollection mJournalInfos; InfoCollection mJournalInfos;
IdCollection<Cell> mCells; IdCollection<Cell> mCells;
@ -195,6 +197,10 @@ namespace CSMWorld
IdCollection<ESM::DebugProfile>& getDebugProfiles(); IdCollection<ESM::DebugProfile>& getDebugProfiles();
const IdCollection<ESM::SoundGenerator>& getSoundGens() const;
IdCollection<ESM::SoundGenerator>& getSoundGens();
/// Throws an exception, if \a id does not match a resources list. /// Throws an exception, if \a id does not match a resources list.
const Resources& getResources (const UniversalId& id) const; const Resources& getResources (const UniversalId& id) const;

View File

@ -52,6 +52,7 @@ namespace
{ CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 }, { CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 },
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_DebugProfiles, "Debug Profiles", 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_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 { 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_Texture, "Texture", 0 },
{ CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Video, "Video", 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_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 { CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
}; };

View File

@ -122,10 +122,12 @@ namespace CSMWorld
Type_Video, Type_Video,
Type_DebugProfiles, Type_DebugProfiles,
Type_DebugProfile, Type_DebugProfile,
Type_SoundGens,
Type_SoundGen,
Type_RunLog Type_RunLog
}; };
enum { NumberOfTypes = Type_DebugProfile+1 }; enum { NumberOfTypes = Type_RunLog+1 };
private: private:

View File

@ -22,4 +22,10 @@ void SoundGenerator::save(ESMWriter &esm) const
esm.writeHNOCString("SNAM", mSound); esm.writeHNOCString("SNAM", mSound);
} }
void SoundGenerator::blank()
{
mType = LeftFoot;
mCreature.clear();
mSound.clear();
}
} }

View File

@ -36,6 +36,8 @@ struct SoundGenerator
void load(ESMReader &esm); void load(ESMReader &esm);
void save(ESMWriter &esm) const; void save(ESMWriter &esm) const;
void blank();
}; };
} }
#endif #endif