1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 15:39:42 +00:00

Clean up fallback record creation

This commit is contained in:
Capostrophic 2018-12-27 23:20:58 +03:00
parent 807e0311b9
commit 7155e787b4
5 changed files with 25 additions and 48 deletions

View file

@ -989,23 +989,29 @@ void CSMWorld::Data::loadFallbackEntries()
std::make_pair("PrisonMarker", "marker_prison.nif") std::make_pair("PrisonMarker", "marker_prison.nif")
}; };
for (const std::pair<std::string, std::string> marker : staticMarkers) for (const std::pair<std::string, std::string> &marker : staticMarkers)
{ {
if (mReferenceables.searchId (marker.first)==-1) if (mReferenceables.searchId (marker.first)==-1)
{ {
ESM::Static newMarker;
newMarker.mId = marker.first;
newMarker.mModel = marker.second;
CSMWorld::Record<ESM::Static> record; CSMWorld::Record<ESM::Static> record;
record.mBase = ESM::Static(marker.first, marker.second); record.mBase = newMarker;
record.mState = CSMWorld::RecordBase::State_BaseOnly; record.mState = CSMWorld::RecordBase::State_BaseOnly;
mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Static); mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Static);
} }
} }
for (const std::pair<std::string, std::string> marker : doorMarkers) for (const std::pair<std::string, std::string> &marker : doorMarkers)
{ {
if (mReferenceables.searchId (marker.first)==-1) if (mReferenceables.searchId (marker.first)==-1)
{ {
ESM::Door newMarker;
newMarker.mId = marker.first;
newMarker.mModel = marker.second;
CSMWorld::Record<ESM::Door> record; CSMWorld::Record<ESM::Door> record;
record.mBase = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string()); record.mBase = newMarker;
record.mState = CSMWorld::RecordBase::State_BaseOnly; record.mState = CSMWorld::RecordBase::State_BaseOnly;
mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Door); mReferenceables.appendRecord (record, CSMWorld::UniversalId::Type_Door);
} }

View file

@ -1007,14 +1007,13 @@ namespace MWWorld
} }
void Store<ESM::Attribute>::setUp() void Store<ESM::Attribute>::setUp()
{ {
for (int i = 0; i < ESM::Attribute::Length; ++i) { for (int i = 0; i < ESM::Attribute::Length; ++i)
mStatic.push_back( {
ESM::Attribute( ESM::Attribute newAttribute;
ESM::Attribute::sAttributeIds[i], newAttribute.mId = ESM::Attribute::sAttributeIds[i];
ESM::Attribute::sGmstAttributeIds[i], newAttribute.mName = ESM::Attribute::sGmstAttributeIds[i];
ESM::Attribute::sGmstAttributeDescIds[i] newAttribute.mDescription = ESM::Attribute::sGmstAttributeDescIds[i];
) mStatic.push_back(newAttribute);
);
} }
} }
size_t Store<ESM::Attribute>::getSize() const size_t Store<ESM::Attribute>::getSize() const
@ -1066,11 +1065,13 @@ namespace MWWorld
std::make_pair("travelmarker", "marker_travel.nif") std::make_pair("travelmarker", "marker_travel.nif")
}; };
for (const std::pair<std::string, std::string> marker : markers) for (const std::pair<std::string, std::string> &marker : markers)
{ {
if (search(marker.first) == 0) if (search(marker.first) == 0)
{ {
ESM::Static newMarker = ESM::Static(marker.first, marker.second); ESM::Static newMarker;
newMarker.mId = marker.first;
newMarker.mModel = marker.second;
std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(marker.first, newMarker)); std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(marker.first, newMarker));
if (ret.first != mStatic.end()) if (ret.first != mStatic.end())
{ {
@ -1088,11 +1089,13 @@ namespace MWWorld
std::make_pair("prisonmarker", "marker_prison.nif") std::make_pair("prisonmarker", "marker_prison.nif")
}; };
for (const std::pair<std::string, std::string> marker : markers) for (const std::pair<std::string, std::string> &marker : markers)
{ {
if (search(marker.first) == 0) if (search(marker.first) == 0)
{ {
ESM::Door newMarker = ESM::Door(marker.first, std::string(), marker.second, std::string(), std::string(), std::string()); ESM::Door newMarker;
newMarker.mId = marker.first;
newMarker.mModel = marker.second;
std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(marker.first, newMarker)); std::pair<typename Static::iterator, bool> ret = mStatic.insert(std::make_pair(marker.first, newMarker));
if (ret.first != mStatic.end()) if (ret.first != mStatic.end())
{ {

View file

@ -32,13 +32,6 @@ struct Attribute
static const std::string sGmstAttributeIds[Length]; static const std::string sGmstAttributeIds[Length];
static const std::string sGmstAttributeDescIds[Length]; static const std::string sGmstAttributeDescIds[Length];
static const std::string sAttributeIcons[Length]; static const std::string sAttributeIcons[Length];
Attribute(AttributeID id, const std::string &name, const std::string &description)
: mId(id)
, mName(name)
, mDescription(description)
{
}
}; };
} }
#endif #endif

View file

@ -22,21 +22,6 @@ struct Door
void blank(); void blank();
///< Set record to default state (does not touch the ID). ///< Set record to default state (does not touch the ID).
Door(const std::string id, const std::string name, const std::string &model,
const std::string script, const std::string opensound, const std::string closesound)
: mId(id)
, mName(name)
, mModel(model)
, mScript(script)
, mOpenSound(opensound)
, mCloseSound(closesound)
{
}
Door()
{
}
}; };
} }
#endif #endif

View file

@ -33,16 +33,6 @@ struct Static
void blank(); void blank();
///< Set record to default state (does not touch the ID). ///< Set record to default state (does not touch the ID).
Static(const std::string id, const std::string &model)
: mId(id)
, mModel(model)
{
}
Static()
{
}
}; };
} }
#endif #endif