mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 22:39:40 +00:00
moved setNestedData to the helper as well
This commit is contained in:
parent
6573e3f319
commit
cb004936e0
2 changed files with 25 additions and 17 deletions
|
@ -2,6 +2,7 @@
|
||||||
#define CSM_WORLD_NESTEDADAPTORS_H
|
#define CSM_WORLD_NESTEDADAPTORS_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
#include "nestedtablewrapper.hpp"
|
#include "nestedtablewrapper.hpp"
|
||||||
|
@ -59,6 +60,28 @@ namespace CSMWorld
|
||||||
throw std::logic_error("Trying to access non-existing column in the nested table!");
|
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:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -285,23 +285,8 @@ void CSMWorld::ContainerRefIdAdapter::setNestedData(const RefIdColumn *column,
|
||||||
{
|
{
|
||||||
|
|
||||||
if (column==mContent)
|
if (column==mContent)
|
||||||
{
|
{
|
||||||
Record<ESM::Container>& record = static_cast<Record<ESM::Container>&> (
|
mHelper.setNestedData(column, data, index, value, subRowIndex, subColIndex);
|
||||||
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!");
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
Loading…
Reference in a new issue