|
|
@ -1090,4 +1090,83 @@ namespace CSMWorld
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FactionRanksAdapter::FactionRanksAdapter () {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FactionRanksAdapter::addRow(Record<ESM::Faction>& record, int position) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw std::logic_error ("cannot add a row to a fixed table");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FactionRanksAdapter::removeRow(Record<ESM::Faction>& record, int rowToRemove) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw std::logic_error ("cannot remove a row from a fixed table");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FactionRanksAdapter::setTable(Record<ESM::Faction>& record,
|
|
|
|
|
|
|
|
const NestedTableWrapperBase& nestedTable) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw std::logic_error ("table operation not supported");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NestedTableWrapperBase* FactionRanksAdapter::table(const Record<ESM::Faction>& record) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw std::logic_error ("table operation not supported");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVariant FactionRanksAdapter::getData(const Record<ESM::Faction>& record,
|
|
|
|
|
|
|
|
int subRowIndex, int subColIndex) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ESM::Faction faction = record.get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (subRowIndex < 0 || subRowIndex >= static_cast<int>(sizeof(faction.mData.mRankData)/sizeof(faction.mData.mRankData[0])))
|
|
|
|
|
|
|
|
throw std::runtime_error ("index out of range");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto& rankData = faction.mData.mRankData[subRowIndex];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (subColIndex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 0: return QString(faction.mRanks[subRowIndex].c_str());
|
|
|
|
|
|
|
|
case 1: return rankData.mAttribute1;
|
|
|
|
|
|
|
|
case 2: return rankData.mAttribute2;
|
|
|
|
|
|
|
|
case 3: return rankData.mSkill1;
|
|
|
|
|
|
|
|
case 4: return rankData.mSkill2;
|
|
|
|
|
|
|
|
case 5: return rankData.mFactReaction;
|
|
|
|
|
|
|
|
default: throw std::runtime_error("Rank subcolumn index out of range");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FactionRanksAdapter::setData(Record<ESM::Faction>& record,
|
|
|
|
|
|
|
|
const QVariant& value, int subRowIndex, int subColIndex) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ESM::Faction faction = record.get();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (subRowIndex < 0 || subRowIndex >= static_cast<int>(sizeof(faction.mData.mRankData)/sizeof(faction.mData.mRankData[0])))
|
|
|
|
|
|
|
|
throw std::runtime_error ("index out of range");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto& rankData = faction.mData.mRankData[subRowIndex];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (subColIndex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 0: faction.mRanks[subRowIndex] = value.toString().toUtf8().constData(); break;
|
|
|
|
|
|
|
|
case 1: rankData.mAttribute1 = value.toInt(); break;
|
|
|
|
|
|
|
|
case 2: rankData.mAttribute2 = value.toInt(); break;
|
|
|
|
|
|
|
|
case 3: rankData.mSkill1 = value.toInt(); break;
|
|
|
|
|
|
|
|
case 4: rankData.mSkill2 = value.toInt(); break;
|
|
|
|
|
|
|
|
case 5: rankData.mFactReaction = value.toInt(); break;
|
|
|
|
|
|
|
|
default: throw std::runtime_error("Rank index out of range");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
record.setModified (faction);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int FactionRanksAdapter::getColumnsCount(const Record<ESM::Faction>& record) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int FactionRanksAdapter::getRowsCount(const Record<ESM::Faction>& record) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 10;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|