mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Merge branch 'OpenCS-preserve-blocked' into 'master'
OpenCS - Preserve "blocked" record flags when saving. #6288 Closes #6288 See merge request OpenMW/openmw!1052
This commit is contained in:
commit
782e0710af
@ -54,9 +54,11 @@
|
||||
Feature #6199: Support FBO Rendering
|
||||
Feature #6249: Alpha testing support for Collada
|
||||
Feature #6251: OpenMW-CS: Set instance movement based on camera zoom
|
||||
Feature #6288: Preserve the "blocked" record flag for referenceable objects.
|
||||
Task #6201: Remove the "Note: No relevant classes found. No output generated" warnings
|
||||
Task #6264: Remove the old classes in animation.cpp
|
||||
|
||||
|
||||
0.47.0
|
||||
------
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace CSMDoc
|
||||
state == CSMWorld::RecordBase::State_ModifiedOnly ||
|
||||
state == CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
writer.startRecord (record.sRecordId);
|
||||
writer.startRecord (record.sRecordId, record.mRecordFlags);
|
||||
record.save (writer, state == CSMWorld::RecordBase::State_Deleted);
|
||||
writer.endRecord (record.sRecordId);
|
||||
}
|
||||
|
@ -371,6 +371,7 @@ namespace CSMWorld
|
||||
{ ColumnId_Skill7, "Skill 7" },
|
||||
|
||||
{ ColumnId_Persistent, "Persistent" },
|
||||
{ ColumnId_Blocked, "Blocked" },
|
||||
|
||||
{ -1, 0 } // end marker
|
||||
};
|
||||
|
@ -344,6 +344,7 @@ namespace CSMWorld
|
||||
ColumnId_FactionAttrib2 = 312,
|
||||
|
||||
ColumnId_Persistent = 313,
|
||||
ColumnId_Blocked = 314,
|
||||
|
||||
// Allocated to a separate value range, so we don't get a collision should we ever need
|
||||
// to extend the number of use values.
|
||||
|
@ -123,6 +123,14 @@ Qt::ItemFlags CSMWorld::IdTable::flags (const QModelIndex & index) const
|
||||
if (mIdCollection->getColumn (index.column()).isUserEditable())
|
||||
flags |= Qt::ItemIsEditable;
|
||||
|
||||
int blockedColumn = searchColumnIndex(Columns::ColumnId_Blocked);
|
||||
if (blockedColumn != -1 && blockedColumn != index.column())
|
||||
{
|
||||
bool isBlocked = mIdCollection->getData(index.row(), blockedColumn).toInt();
|
||||
if (isBlocked)
|
||||
flags = Qt::ItemIsSelectable; // not enabled (to grey out)
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,9 @@ namespace CSMWorld
|
||||
const RefIdColumn *mId;
|
||||
const RefIdColumn *mModified;
|
||||
const RefIdColumn *mType;
|
||||
const RefIdColumn *mBlocked;
|
||||
|
||||
BaseColumns () : mBlocked(nullptr) {}
|
||||
};
|
||||
|
||||
/// \brief Base adapter for all refereceable record types
|
||||
@ -90,6 +93,9 @@ namespace CSMWorld
|
||||
if (column==mBase.mType)
|
||||
return static_cast<int> (mType);
|
||||
|
||||
if (column==mBase.mBlocked)
|
||||
return (record.get().mRecordFlags & ESM::FLAG_Blocked) != 0;
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@ -102,6 +108,17 @@ namespace CSMWorld
|
||||
|
||||
if (column==mBase.mModified)
|
||||
record.mState = static_cast<RecordBase::State> (value.toInt());
|
||||
else if (column==mBase.mBlocked)
|
||||
{
|
||||
RecordT record2 = record.get();
|
||||
|
||||
if (value.toInt() != 0)
|
||||
record2.mRecordFlags |= ESM::FLAG_Blocked;
|
||||
else
|
||||
record2.mRecordFlags &= ~ESM::FLAG_Blocked;
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename RecordT>
|
||||
@ -110,6 +127,14 @@ namespace CSMWorld
|
||||
return mType;
|
||||
}
|
||||
|
||||
// NOTE: Body Part should not have persistence (but BodyPart is not listed in the Objects
|
||||
// table at the moment).
|
||||
//
|
||||
// Spellmaking - not persistent - currently not part of objects table
|
||||
// Enchanting - not persistent - currently not part of objects table
|
||||
//
|
||||
// Leveled Creature - no model, so not persistent
|
||||
// Leveled Item - no model, so not persistent
|
||||
|
||||
struct ModelColumns : public BaseColumns
|
||||
{
|
||||
|
@ -50,13 +50,16 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
||||
mColumns.emplace_back(Columns::ColumnId_RecordType, ColumnBase::Display_RefRecordType,
|
||||
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false);
|
||||
baseColumns.mType = &mColumns.back();
|
||||
mColumns.emplace_back(Columns::ColumnId_Blocked, ColumnBase::Display_Boolean,
|
||||
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh);
|
||||
baseColumns.mBlocked = &mColumns.back();
|
||||
|
||||
ModelColumns modelColumns (baseColumns);
|
||||
|
||||
mColumns.emplace_back(Columns::ColumnId_Model, ColumnBase::Display_Mesh);
|
||||
modelColumns.mModel = &mColumns.back();
|
||||
mColumns.emplace_back(Columns::ColumnId_Persistent, ColumnBase::Display_Boolean);
|
||||
modelColumns.mPersistence = &mColumns.back();
|
||||
mColumns.emplace_back(Columns::ColumnId_Model, ColumnBase::Display_Mesh);
|
||||
modelColumns.mModel = &mColumns.back();
|
||||
|
||||
NameColumns nameColumns (modelColumns);
|
||||
|
||||
|
@ -538,6 +538,9 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
mainLayout->addLayout(tablesLayout, QSizePolicy::Preferred);
|
||||
mainLayout->addStretch(1);
|
||||
|
||||
int blockedColumn = mTable->searchColumnIndex(CSMWorld::Columns::ColumnId_Blocked);
|
||||
bool isBlocked = mTable->data(mTable->index(row, blockedColumn)).toInt();
|
||||
|
||||
int unlocked = 0;
|
||||
int locked = 0;
|
||||
const int columns = mTable->columnCount();
|
||||
@ -583,6 +586,8 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
NestedTable* table =
|
||||
new NestedTable(mDocument, id, mNestedModels.back(), this, editable, fixedRows);
|
||||
table->resizeColumnsToContents();
|
||||
if (isBlocked)
|
||||
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
|
||||
int rows = mTable->rowCount(mTable->index(row, i));
|
||||
int rowHeight = (rows == 0) ? table->horizontalHeader()->height() : table->rowHeight(0);
|
||||
@ -617,7 +622,9 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
label->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
editor->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
if (! (mTable->flags (mTable->index (row, i)) & Qt::ItemIsEditable))
|
||||
// HACK: the blocked checkbox needs to keep the same position
|
||||
// FIXME: unfortunately blocked record displays a little differently to unblocked one
|
||||
if (!(mTable->flags (mTable->index (row, i)) & Qt::ItemIsEditable) || i == blockedColumn)
|
||||
{
|
||||
lockedLayout->addWidget (label, locked, 0);
|
||||
lockedLayout->addWidget (editor, locked, 1);
|
||||
@ -639,7 +646,7 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
createEditorContextMenu(editor, display, row);
|
||||
}
|
||||
}
|
||||
else
|
||||
else // Flag_Dialogue_List
|
||||
{
|
||||
CSMWorld::IdTree *tree = static_cast<CSMWorld::IdTree *>(mTable);
|
||||
mNestedTableMapper = new QDataWidgetMapper (this);
|
||||
@ -686,7 +693,10 @@ void CSVWorld::EditWidget::remake(int row)
|
||||
label->setEnabled(false);
|
||||
}
|
||||
|
||||
createEditorContextMenu(editor, display, row);
|
||||
if (!isBlocked)
|
||||
createEditorContextMenu(editor, display, row);
|
||||
else
|
||||
editor->setEnabled(false);
|
||||
}
|
||||
}
|
||||
mNestedTableMapper->setCurrentModelIndex(tree->index(0, 0, tree->index(row, i)));
|
||||
|
@ -9,6 +9,7 @@ unsigned int ESM::DebugProfile::sRecordId = REC_DBGP;
|
||||
void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
while (esm.hasMoreSubs())
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ namespace ESM
|
||||
Flag_Global = 4 // make available from main menu (i.e. not location specific)
|
||||
};
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
std::string mDescription;
|
||||
|
@ -9,6 +9,7 @@ unsigned int ESM::Filter::sRecordId = REC_FILT;
|
||||
void ESM::Filter::load (ESMReader& esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
while (esm.hasMoreSubs())
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ namespace ESM
|
||||
{
|
||||
static unsigned int sRecordId;
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
std::string mDescription;
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void BodyPart::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
bool hasData = false;
|
||||
|
@ -58,6 +58,7 @@ struct BodyPart
|
||||
};
|
||||
|
||||
BYDTstruct mData;
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mModel, mRace;
|
||||
|
||||
void load(ESMReader &esm, bool &isDeleted);
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void BirthSign::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mPowers.mList.clear();
|
||||
|
||||
|
@ -17,6 +17,7 @@ struct BirthSign
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "BirthSign"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mName, mDescription, mTexture;
|
||||
|
||||
// List of powers and abilities that come with this birth sign.
|
||||
|
@ -41,6 +41,7 @@ namespace ESM
|
||||
void Class::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
bool hasData = false;
|
||||
|
@ -70,6 +70,7 @@ struct Class
|
||||
///< Throws an exception for invalid values of \a index.
|
||||
}; // 60 bytes
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mName, mDescription;
|
||||
CLDTstruct mData;
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void Enchantment::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
mEffects.mList.clear();
|
||||
|
||||
bool hasName = false;
|
||||
|
@ -42,6 +42,7 @@ struct Enchantment
|
||||
int mFlags;
|
||||
};
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
ENDTstruct mData;
|
||||
EffectList mEffects;
|
||||
|
@ -29,6 +29,7 @@ namespace ESM
|
||||
void Faction::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mReactions.clear();
|
||||
for (int i=0;i<10;++i)
|
||||
|
@ -34,6 +34,7 @@ struct Faction
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "Faction"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mName;
|
||||
|
||||
struct FADTstruct
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void Global::load (ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mId = esm.getHNString ("NAME");
|
||||
|
||||
|
@ -21,6 +21,7 @@ struct Global
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "Global"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
Variant mValue;
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void GameSetting::load (ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false; // GameSetting record can't be deleted now (may be changed in the future)
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mId = esm.getHNString("NAME");
|
||||
mValue.read (esm, ESM::Variant::Format_Gmst);
|
||||
|
@ -22,6 +22,7 @@ struct GameSetting
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "GameSetting"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
Variant mValue;
|
||||
|
@ -189,6 +189,7 @@ namespace ESM
|
||||
void MagicEffect::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false; // MagicEffect record can't be deleted now (may be changed in the future)
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
esm.getHNT(mIndex, "INDX");
|
||||
|
||||
|
@ -16,6 +16,7 @@ struct MagicEffect
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "MagicEffect"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
enum Flags
|
||||
|
@ -21,6 +21,7 @@ namespace ESM
|
||||
void Race::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mPowers.mList.clear();
|
||||
|
||||
|
@ -65,6 +65,7 @@ struct Race
|
||||
|
||||
RADTstruct mData;
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mName, mDescription;
|
||||
SpellList mPowers;
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void Region::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
while (esm.hasMoreSubs())
|
||||
|
@ -45,6 +45,7 @@ struct Region
|
||||
WEATstruct mData;
|
||||
int mMapColor; // RGBA
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
// sleepList refers to a leveled list of creatures you can meet if
|
||||
// you sleep outside in this region.
|
||||
std::string mId, mName, mSleepList;
|
||||
|
@ -83,6 +83,7 @@ namespace ESM
|
||||
void Script::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mVarNames.clear();
|
||||
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
Script::SCHDstruct mData;
|
||||
};
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
SCHDstruct mData;
|
||||
|
@ -130,6 +130,7 @@ namespace ESM
|
||||
void Skill::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false; // Skill record can't be deleted now (may be changed in the future)
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasIndex = false;
|
||||
bool hasData = false;
|
||||
|
@ -22,6 +22,7 @@ struct Skill
|
||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||
static std::string getRecordType() { return "Skill"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
struct SKDTstruct
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void SoundGenerator::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
bool hasData = false;
|
||||
|
@ -34,6 +34,7 @@ struct SoundGenerator
|
||||
// Type
|
||||
int mType;
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mCreature, mSound;
|
||||
|
||||
void load(ESMReader &esm, bool &isDeleted);
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void Sound::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasName = false;
|
||||
bool hasData = false;
|
||||
|
@ -21,6 +21,7 @@ struct Sound
|
||||
static std::string getRecordType() { return "Sound"; }
|
||||
|
||||
SOUNstruct mData;
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mSound;
|
||||
|
||||
void load(ESMReader &esm, bool &isDeleted);
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void Spell::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
mEffects.mList.clear();
|
||||
|
||||
|
@ -42,6 +42,7 @@ struct Spell
|
||||
};
|
||||
|
||||
SPDTstruct mData;
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId, mName;
|
||||
EffectList mEffects;
|
||||
|
||||
|
@ -11,6 +11,7 @@ namespace ESM
|
||||
void StartScript::load(ESMReader &esm, bool &isDeleted)
|
||||
{
|
||||
isDeleted = false;
|
||||
mRecordFlags = esm.getRecordFlags();
|
||||
|
||||
bool hasData = false;
|
||||
bool hasName = false;
|
||||
|
@ -24,6 +24,7 @@ struct StartScript
|
||||
static std::string getRecordType() { return "StartScript"; }
|
||||
|
||||
std::string mData;
|
||||
unsigned int mRecordFlags;
|
||||
std::string mId;
|
||||
|
||||
// Load a record and add it to the list
|
||||
|
Loading…
x
Reference in New Issue
Block a user