mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:53:52 +00:00
5fffcab94f
- The order of info records with the same topic are maintained in Collection::mRecords
- The index lookup data structure are not ordered. The topic string is hashed. The infos for the topic are simply placed in a vector.
- The index values for appending or inserting a record takes prev/next values (if exist)
- FIXME: prev/next values are not adjusted for adding or removing records
- FIXME: undo after reordering does not reset the modified flag
(copied the changes from commit SHA-1: 06f9922822
)
35 lines
779 B
C++
35 lines
779 B
C++
#include "collectionbase.hpp"
|
|
|
|
#include <stdexcept>
|
|
|
|
#include "columnbase.hpp"
|
|
|
|
CSMWorld::CollectionBase::CollectionBase() {}
|
|
|
|
CSMWorld::CollectionBase::~CollectionBase() {}
|
|
|
|
int CSMWorld::CollectionBase::getInsertIndex (const std::string& id, UniversalId::Type type, RecordBase *record) const
|
|
{
|
|
return getAppendIndex(id, type);
|
|
}
|
|
|
|
int CSMWorld::CollectionBase::searchColumnIndex (Columns::ColumnId id) const
|
|
{
|
|
int columns = getColumns();
|
|
|
|
for (int i=0; i<columns; ++i)
|
|
if (getColumn (i).mColumnId==id)
|
|
return i;
|
|
|
|
return -1;
|
|
}
|
|
|
|
int CSMWorld::CollectionBase::findColumnIndex (Columns::ColumnId id) const
|
|
{
|
|
int index = searchColumnIndex (id);
|
|
|
|
if (index==-1)
|
|
throw std::logic_error ("invalid column index");
|
|
|
|
return index;
|
|
}
|