2013-05-11 15:01:16 +00:00
|
|
|
|
|
|
|
#include "refidadapterimp.hpp"
|
|
|
|
|
2013-05-12 13:50:29 +00:00
|
|
|
CSMWorld::PotionRefIdAdapter::PotionRefIdAdapter (const InventoryColumns& columns,
|
|
|
|
const RefIdColumn *autoCalc)
|
|
|
|
: InventoryRefIdAdapter<ESM::Potion> (UniversalId::Type_Potion, columns),
|
|
|
|
mAutoCalc (autoCalc)
|
|
|
|
{}
|
2013-05-11 15:01:16 +00:00
|
|
|
|
2013-05-12 13:50:29 +00:00
|
|
|
QVariant CSMWorld::PotionRefIdAdapter::getData (const RefIdColumn *column, const RefIdData& data,
|
|
|
|
int index) const
|
|
|
|
{
|
|
|
|
const Record<ESM::Potion>& record = static_cast<const Record<ESM::Potion>&> (
|
|
|
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Potion)));
|
2013-05-11 15:01:16 +00:00
|
|
|
|
2013-05-12 13:50:29 +00:00
|
|
|
if (column==mAutoCalc)
|
2013-05-13 12:07:31 +00:00
|
|
|
return record.get().mData.mAutoCalc!=0;
|
2013-05-12 13:50:29 +00:00
|
|
|
|
|
|
|
return InventoryRefIdAdapter<ESM::Potion>::getData (column, data, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSMWorld::PotionRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
|
|
|
const QVariant& value) const
|
|
|
|
{
|
|
|
|
Record<ESM::Potion>& record = static_cast<Record<ESM::Potion>&> (
|
|
|
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Potion)));
|
|
|
|
|
|
|
|
if (column==mAutoCalc)
|
|
|
|
record.get().mData.mAutoCalc = value.toInt();
|
|
|
|
else
|
|
|
|
InventoryRefIdAdapter<ESM::Potion>::setData (column, data, index, value);
|
2013-05-13 10:51:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSMWorld::ApparatusRefIdAdapter::ApparatusRefIdAdapter (const InventoryColumns& columns,
|
|
|
|
const RefIdColumn *type, const RefIdColumn *quality)
|
|
|
|
: InventoryRefIdAdapter<ESM::Apparatus> (UniversalId::Type_Apparatus, columns),
|
|
|
|
mType (type), mQuality (quality)
|
|
|
|
{}
|
|
|
|
|
|
|
|
QVariant CSMWorld::ApparatusRefIdAdapter::getData (const RefIdColumn *column,
|
|
|
|
const RefIdData& data, int index) const
|
|
|
|
{
|
|
|
|
const Record<ESM::Apparatus>& record = static_cast<const Record<ESM::Apparatus>&> (
|
|
|
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Apparatus)));
|
|
|
|
|
|
|
|
if (column==mType)
|
|
|
|
return record.get().mData.mType;
|
|
|
|
|
|
|
|
if (column==mQuality)
|
|
|
|
return record.get().mData.mQuality;
|
|
|
|
|
|
|
|
return InventoryRefIdAdapter<ESM::Apparatus>::getData (column, data, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSMWorld::ApparatusRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
|
|
|
const QVariant& value) const
|
|
|
|
{
|
|
|
|
Record<ESM::Apparatus>& record = static_cast<Record<ESM::Apparatus>&> (
|
|
|
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Apparatus)));
|
|
|
|
|
|
|
|
if (column==mType)
|
|
|
|
record.get().mData.mType = value.toInt();
|
|
|
|
else if (column==mQuality)
|
|
|
|
record.get().mData.mQuality = value.toFloat();
|
|
|
|
else
|
|
|
|
InventoryRefIdAdapter<ESM::Apparatus>::setData (column, data, index, value);
|
2013-05-12 13:50:29 +00:00
|
|
|
}
|