mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 07:19:54 +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:
|
||||
|
||||
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
|
||||
{
|
||||
assert(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())
|
||||
if(column!=mContent)
|
||||
{
|
||||
list.push_back(newRow);
|
||||
return;
|
||||
throw std::logic_error("This column does not hold multiple values.");
|
||||
}
|
||||
|
||||
list.insert(list.begin()+position, newRow);
|
||||
|
||||
return;
|
||||
mHelper.addNestedRow(column, data, index, position);
|
||||
}
|
||||
|
||||
void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||
|
|
Loading…
Reference in a new issue