mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 13:49:55 +00:00
moved add nested to the helper
This commit is contained in:
parent
427d6efd19
commit
dcd90faaef
2 changed files with 17 additions and 12 deletions
|
@ -90,6 +90,20 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const
|
||||||
|
{
|
||||||
|
std::vector<ESM::ContItem>& list = getRecord(data, index).get().mInventory.mList;
|
||||||
|
|
||||||
|
ESM::ContItem newRow = {0, ""};
|
||||||
|
if (position >= (int)list.size())
|
||||||
|
{
|
||||||
|
list.push_back(newRow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.insert(list.begin()+position, newRow);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const Record<ESXRecordT>& getRecord(const RefIdData& data, int index) const
|
const Record<ESXRecordT>& getRecord(const RefIdData& data, int index) const
|
||||||
|
|
|
@ -232,21 +232,12 @@ void CSMWorld::ContainerRefIdAdapter::removeNestedRow (const RefIdColumn *column
|
||||||
|
|
||||||
void CSMWorld::ContainerRefIdAdapter::addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const
|
void CSMWorld::ContainerRefIdAdapter::addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const
|
||||||
{
|
{
|
||||||
assert(column==mContent);
|
if(column!=mContent)
|
||||||
|
|
||||||
std::vector<ESM::ContItem>& list = static_cast<Record<ESM::Container>&> (
|
|
||||||
data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Container))).get().mInventory.mList;
|
|
||||||
|
|
||||||
ESM::ContItem newRow = {0, ""};
|
|
||||||
if (position >= (int)list.size())
|
|
||||||
{
|
{
|
||||||
list.push_back(newRow);
|
throw std::logic_error("This column does not hold multiple values.");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list.insert(list.begin()+position, newRow);
|
mHelper.addNestedRow(column, data, index, position);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
|
|
Loading…
Reference in a new issue