forked from mirror/openmw-tes3mp
does not compile
This commit is contained in:
parent
befc7a4078
commit
41db48720d
4 changed files with 90 additions and 1 deletions
|
@ -1,6 +1,20 @@
|
||||||
|
|
||||||
#include "refidadapter.hpp"
|
#include "refidadapter.hpp"
|
||||||
|
|
||||||
|
#include "cassert"
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
CSMWorld::RefIdAdapter::RefIdAdapter() {}
|
CSMWorld::RefIdAdapter::RefIdAdapter() {}
|
||||||
|
|
||||||
CSMWorld::RefIdAdapter::~RefIdAdapter() {}
|
CSMWorld::RefIdAdapter::~RefIdAdapter() {}
|
||||||
|
|
||||||
|
QVariant CSMWorld::RefIdAdapter::getData (const CSMWorld::RefIdColumn* column, const CSMWorld::RefIdData& data, int idnex, int subRowIndex, int subColIndex) const
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMWorld::RefIdAdapter::setData (const CSMWorld::RefIdColumn* column, CSMWorld::RefIdData& data, const QVariant& value, int index, int subRowIndex, int subColIndex) const
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,13 @@ namespace CSMWorld
|
||||||
const QVariant& value) const = 0;
|
const QVariant& value) const = 0;
|
||||||
///< If the data type does not match an exception is thrown.
|
///< If the data type does not match an exception is thrown.
|
||||||
|
|
||||||
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data,
|
||||||
|
int idnex, int subRowIndex, int subColIndex) const;
|
||||||
|
|
||||||
|
virtual void setData (const RefIdColumn *column, RefIdData& data,
|
||||||
|
const QVariant& value, int index,
|
||||||
|
int subRowIndex, int subColIndex) const;
|
||||||
|
|
||||||
virtual std::string getId (const RecordBase& record) const = 0;
|
virtual std::string getId (const RecordBase& record) const = 0;
|
||||||
virtual void setId(RecordBase& record, const std::string& id) = 0;
|
virtual void setId(RecordBase& record, const std::string& id) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -222,6 +222,66 @@ void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdD
|
||||||
NameRefIdAdapter<ESM::Container>::setData (column, data, index, value);
|
NameRefIdAdapter<ESM::Container>::setData (column, data, index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMWorld::ContainerRefIdAdapter::setData(const RefIdColumn *column, RefIdData& data,
|
||||||
|
int index,
|
||||||
|
const QVariant& value,
|
||||||
|
int subRowIndex,
|
||||||
|
int subColIndex)
|
||||||
|
{
|
||||||
|
using RefIdAdapter::setData;
|
||||||
|
Record<ESM::Container>& record = static_cast<Record<ESM::Container>&> (
|
||||||
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Container)));
|
||||||
|
|
||||||
|
if (column==mContent)
|
||||||
|
{
|
||||||
|
switch (subColIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
record.get().mInventory.mList.at(subRowIndex).mItem.assign(std::string(value.toString().toUtf8().constData()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
record.get().mInventory.mList.at(subRowIndex).mCount = value.toInt();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
throw "This column does not hold multiple values.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CSMWorld::ContainerRefIdAdapter::getData (const CSMWorld::RefIdColumn* column,
|
||||||
|
const CSMWorld::RefIdData& data,
|
||||||
|
int index,
|
||||||
|
int subRowIndex,
|
||||||
|
int subColIndex) const
|
||||||
|
{
|
||||||
|
using RefIdAdapter::getData;
|
||||||
|
const Record<ESM::Container>& record = static_cast<const Record<ESM::Container>&> (
|
||||||
|
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Container)));
|
||||||
|
|
||||||
|
if (column==mContent)
|
||||||
|
{
|
||||||
|
const ESM::ContItem& content = record.get().mInventory.mList.at(subRowIndex);
|
||||||
|
|
||||||
|
switch (subColIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return QString::fromUtf8(content.mItem.toString().c_str());
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return content.mCount;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw "Trying to access non-existing column in the nested table!";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
throw "This column does not hold multiple values.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMWorld::CreatureColumns::CreatureColumns (const ActorColumns& actorColumns)
|
CSMWorld::CreatureColumns::CreatureColumns (const ActorColumns& actorColumns)
|
||||||
: ActorColumns (actorColumns)
|
: ActorColumns (actorColumns)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -617,9 +617,17 @@ namespace CSMWorld
|
||||||
ContainerRefIdAdapter (const NameColumns& columns, const RefIdColumn *weight,
|
ContainerRefIdAdapter (const NameColumns& columns, const RefIdColumn *weight,
|
||||||
const RefIdColumn *organic, const RefIdColumn *respawn, const RefIdColumn *content);
|
const RefIdColumn *organic, const RefIdColumn *respawn, const RefIdColumn *content);
|
||||||
|
|
||||||
|
using RefIdAdapter::getData;
|
||||||
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index,
|
||||||
|
int subRowIndex, int subColIndex) const;
|
||||||
|
|
||||||
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
|
virtual QVariant getData (const RefIdColumn *column, const RefIdData& data, int index)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
|
using RefIdAdapter::setData;
|
||||||
|
virtual void setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
|
const QVariant& value, int subRowIndex, int subColIndex) const;
|
||||||
|
|
||||||
virtual void setData (const RefIdColumn *column, RefIdData& data, int index,
|
virtual void setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
const QVariant& value) const;
|
const QVariant& value) const;
|
||||||
///< If the data type does not match an exception is thrown.
|
///< If the data type does not match an exception is thrown.
|
||||||
|
|
Loading…
Reference in a new issue