mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 00:06:43 +00:00
removed some hardcoded column numbers
This commit is contained in:
parent
85fca19fd9
commit
e4a37ef709
1 changed files with 8 additions and 4 deletions
|
@ -13,14 +13,16 @@ std::vector<std::string> CSMWorld::CommandDispatcher::getDeletableRecords() cons
|
||||||
|
|
||||||
IdTable& model = dynamic_cast<IdTable&> (*mDocument.getData().getTableModel (mId));
|
IdTable& model = dynamic_cast<IdTable&> (*mDocument.getData().getTableModel (mId));
|
||||||
|
|
||||||
|
int stateColumnIndex = model.findColumnIndex (Columns::ColumnId_Modification);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (mSelection.begin());
|
for (std::vector<std::string>::const_iterator iter (mSelection.begin());
|
||||||
iter!=mSelection.end(); ++iter)
|
iter!=mSelection.end(); ++iter)
|
||||||
{
|
{
|
||||||
int row = model.getModelIndex (*iter, 0).row();
|
int row = model.getModelIndex (*iter, 0).row();
|
||||||
|
|
||||||
// check record state
|
// check record state
|
||||||
RecordBase::State state =
|
RecordBase::State state = static_cast<RecordBase::State> (
|
||||||
static_cast<RecordBase::State> (model.data (model.index (row, 1)).toInt());
|
model.data (model.index (row, stateColumnIndex)).toInt());
|
||||||
|
|
||||||
if (state==RecordBase::State_Deleted)
|
if (state==RecordBase::State_Deleted)
|
||||||
continue;
|
continue;
|
||||||
|
@ -53,14 +55,16 @@ std::vector<std::string> CSMWorld::CommandDispatcher::getRevertableRecords() con
|
||||||
if (model.getFeatures() & IdTable::Feature_ReorderWithinTopic)
|
if (model.getFeatures() & IdTable::Feature_ReorderWithinTopic)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
int stateColumnIndex = model.findColumnIndex (Columns::ColumnId_Modification);
|
||||||
|
|
||||||
for (std::vector<std::string>::const_iterator iter (mSelection.begin());
|
for (std::vector<std::string>::const_iterator iter (mSelection.begin());
|
||||||
iter!=mSelection.end(); ++iter)
|
iter!=mSelection.end(); ++iter)
|
||||||
{
|
{
|
||||||
int row = model.getModelIndex (*iter, 0).row();
|
int row = model.getModelIndex (*iter, 0).row();
|
||||||
|
|
||||||
// check record state
|
// check record state
|
||||||
RecordBase::State state =
|
RecordBase::State state = static_cast<RecordBase::State> (
|
||||||
static_cast<RecordBase::State> (model.data (model.index (row, 1)).toInt());
|
model.data (model.index (row, stateColumnIndex)).toInt());
|
||||||
|
|
||||||
if (state==RecordBase::State_BaseOnly)
|
if (state==RecordBase::State_BaseOnly)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue