From a8427c2efb6427c5751cda271e8db2408aa0e2b9 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Tue, 3 Mar 2015 07:36:11 +1100 Subject: [PATCH 1/3] Do not add NAME subrecords while saving magic effects or scripts. --- apps/opencs/model/doc/savingstages.hpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/opencs/model/doc/savingstages.hpp b/apps/opencs/model/doc/savingstages.hpp index 6607e99682..8b79f2ddb8 100644 --- a/apps/opencs/model/doc/savingstages.hpp +++ b/apps/opencs/model/doc/savingstages.hpp @@ -103,19 +103,14 @@ namespace CSMDoc if (state==CSMWorld::RecordBase::State_Modified || state==CSMWorld::RecordBase::State_ModifiedOnly) { - // FIXME: A quick Workaround to support SKIL records which should not write NAME. - // If there are more idcollection records that don't use NAME then a more - // generic solution may be required. The conversion code was simply - // copied from esmwriter. There's room for improving speed a little bit - // here if it turns out to be an issue. + // FIXME: A quick Workaround to support records which should not write + // NAME, including SKIL, MGEF and SCPT. If there are many more + // idcollection records that doesn't use NAME then a more generic + // solution may be required. uint32_t name = mCollection.getRecord (stage).mModified.sRecordId; mState.getWriter().startRecord (name); - std::string type; - for (int i=0; i<4; ++i) - /// \todo make endianess agnostic - type += reinterpret_cast (&name)[i]; - if(type != "SKIL") + if(name != ESM::REC_SKIL && name != ESM::REC_MGEF && name != ESM::REC_SCPT) mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage)); mCollection.getRecord (stage).mModified.save (mState.getWriter()); mState.getWriter().endRecord (mCollection.getRecord (stage).mModified.sRecordId); From 7c0f5b72c5941ccca810fff45fe6286fc6be68bf Mon Sep 17 00:00:00 2001 From: cc9cii Date: Tue, 3 Mar 2015 08:31:06 +1100 Subject: [PATCH 2/3] Add enum namespace to workaround travis. --- apps/opencs/model/doc/savingstages.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/doc/savingstages.hpp b/apps/opencs/model/doc/savingstages.hpp index 8b79f2ddb8..edf8c26408 100644 --- a/apps/opencs/model/doc/savingstages.hpp +++ b/apps/opencs/model/doc/savingstages.hpp @@ -110,7 +110,8 @@ namespace CSMDoc uint32_t name = mCollection.getRecord (stage).mModified.sRecordId; mState.getWriter().startRecord (name); - if(name != ESM::REC_SKIL && name != ESM::REC_MGEF && name != ESM::REC_SCPT) + if(name != ESM::RecNameInts::REC_SKIL && + name != ESM::RecNameInts::REC_MGEF && name != ESM::RecNameInts::REC_SCPT) mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage)); mCollection.getRecord (stage).mModified.save (mState.getWriter()); mState.getWriter().endRecord (mCollection.getRecord (stage).mModified.sRecordId); From 66ef9d237ce5612fa9940f716909667016f9f9d9 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Tue, 3 Mar 2015 10:12:40 +1100 Subject: [PATCH 3/3] Another try to make it work with gcc/travis. --- apps/opencs/model/doc/savingstages.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/opencs/model/doc/savingstages.hpp b/apps/opencs/model/doc/savingstages.hpp index edf8c26408..907041114d 100644 --- a/apps/opencs/model/doc/savingstages.hpp +++ b/apps/opencs/model/doc/savingstages.hpp @@ -7,6 +7,8 @@ #include "../world/idcollection.hpp" #include "../world/scope.hpp" +#include + #include "savingstate.hpp" namespace ESM @@ -110,8 +112,7 @@ namespace CSMDoc uint32_t name = mCollection.getRecord (stage).mModified.sRecordId; mState.getWriter().startRecord (name); - if(name != ESM::RecNameInts::REC_SKIL && - name != ESM::RecNameInts::REC_MGEF && name != ESM::RecNameInts::REC_SCPT) + if(name != ESM::REC_SKIL && name != ESM::REC_MGEF && name != ESM::REC_SCPT) mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage)); mCollection.getRecord (stage).mModified.save (mState.getWriter()); mState.getWriter().endRecord (mCollection.getRecord (stage).mModified.sRecordId);