mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
moved setNestedData to the helper as well
This commit is contained in:
parent
6573e3f319
commit
cb004936e0
@ -2,6 +2,7 @@
|
||||
#define CSM_WORLD_NESTEDADAPTORS_H
|
||||
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "universalid.hpp"
|
||||
#include "nestedtablewrapper.hpp"
|
||||
@ -59,6 +60,28 @@ namespace CSMWorld
|
||||
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
||||
}
|
||||
}
|
||||
|
||||
void setNestedData (const RefIdColumn *column,
|
||||
RefIdData& data,
|
||||
int index,
|
||||
const QVariant& value,
|
||||
int subRowIndex,
|
||||
int subColIndex) const
|
||||
{
|
||||
switch(subColIndex)
|
||||
{
|
||||
case 0:
|
||||
getRecord(data, index).get().mInventory.mList.at(subRowIndex).mItem.assign(std::string(value.toString().toUtf8().constData()));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
getRecord(data, index).get().mInventory.mList.at(subRowIndex).mCount = value.toInt();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
@ -285,23 +285,8 @@ void CSMWorld::ContainerRefIdAdapter::setNestedData(const RefIdColumn *column,
|
||||
{
|
||||
|
||||
if (column==mContent)
|
||||
{
|
||||
Record<ESM::Container>& record = static_cast<Record<ESM::Container>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Container)));
|
||||
|
||||
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;
|
||||
|
||||
default:
|
||||
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
||||
}
|
||||
{
|
||||
mHelper.setNestedData(column, data, index, value, subRowIndex, subColIndex);
|
||||
} else
|
||||
{
|
||||
assert(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user