1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 09:53:54 +00:00
openmw/apps/opencs/model/world/collectionbase.cpp

35 lines
784 B
C++
Raw Normal View History

#include "collectionbase.hpp"
#include <stdexcept>
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/world/columns.hpp>
#include <apps/opencs/model/world/universalid.hpp>
#include "columnbase.hpp"
int CSMWorld::CollectionBase::getInsertIndex(const ESM::RefId& id, UniversalId::Type type, RecordBase* record) const
{
return getAppendIndex(id, type);
}
2022-09-22 18:26:05 +00:00
int CSMWorld::CollectionBase::searchColumnIndex(Columns::ColumnId id) const
{
int columns = getColumns();
2022-09-22 18:26:05 +00:00
for (int i = 0; i < columns; ++i)
if (getColumn(i).mColumnId == id)
return i;
return -1;
}
2022-09-22 18:26:05 +00:00
int CSMWorld::CollectionBase::findColumnIndex(Columns::ColumnId id) const
{
2022-09-22 18:26:05 +00:00
int index = searchColumnIndex(id);
2022-09-22 18:26:05 +00:00
if (index == -1)
throw std::logic_error("invalid column index");
return index;
2015-03-11 14:54:45 +00:00
}