diff --git a/apps/opencs/model/world/nestedadaptors.hpp b/apps/opencs/model/world/nestedadaptors.hpp index 8f82482d85..a961d19e46 100644 --- a/apps/opencs/model/world/nestedadaptors.hpp +++ b/apps/opencs/model/world/nestedadaptors.hpp @@ -61,6 +61,13 @@ namespace CSMWorld } } + void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) const + { + std::vector& list = getRecord(data, index).get().mInventory.mList; + + list.erase (list.begin () + rowToRemove); + } + void setNestedData (const RefIdColumn *column, RefIdData& data, int index, diff --git a/apps/opencs/model/world/refidadapterimp.cpp b/apps/opencs/model/world/refidadapterimp.cpp index f85138d97c..2a8fec01d6 100644 --- a/apps/opencs/model/world/refidadapterimp.cpp +++ b/apps/opencs/model/world/refidadapterimp.cpp @@ -227,11 +227,7 @@ void CSMWorld::ContainerRefIdAdapter::removeNestedRow (const RefIdColumn *column { throw std::logic_error("This column does not hold multiple values."); } - - std::vector& list = static_cast&> ( - data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Container))).get().mInventory.mList; - - list.erase (list.begin () + rowToRemove); + mHelper.removeNestedRow(column, data, index, rowToRemove); } void CSMWorld::ContainerRefIdAdapter::addNestedRow (const RefIdColumn *column, RefIdData& data, int index, int position) const