fixed RefID search

pull/16/head
Marc Zinnschlag 12 years ago
parent 0f29ab8cf9
commit 02ace69511

@ -4,6 +4,7 @@
#include <stdexcept>
#include "refidadapter.hpp"
#include "refidadapterimp.hpp"
CSMWorld::RefIdColumn::RefIdColumn (const std::string& title, Display displayType, int flag,
bool editable, bool userEditable)
@ -37,7 +38,11 @@ CSMWorld::RefIdCollection::RefIdCollection()
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false));
mColumns.push_back (RefIdColumn ("*", ColumnBase::Display_Integer,
ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue, false, false));
mColumns.push_back (RefIdColumn ("Name", ColumnBase::Display_String));
// mColumns.push_back (RefIdColumn ("Name", ColumnBase::Display_String));
mAdapters.insert (std::make_pair (UniversalId::Type_Static, new StaticRefIdAdapter (&mColumns[0],
&mColumns[1])));
}
CSMWorld::RefIdCollection::~RefIdCollection()
@ -107,7 +112,12 @@ void CSMWorld::RefIdCollection::appendBlankRecord (const std::string& id, Univer
int CSMWorld::RefIdCollection::searchId (const std::string& id) const
{
return mData.localToGlobalIndex (mData.searchId (id));
RefIdData::LocalIndex localIndex = mData.searchId (id);
if (localIndex.first==-1)
return -1;
return mData.localToGlobalIndex (localIndex);
}
void CSMWorld::RefIdCollection::replace (int index, const RecordBase& record)

@ -71,7 +71,7 @@ CSMWorld::RefIdData::LocalIndex CSMWorld::RefIdData::searchId (
std::map<std::string, std::pair<int, UniversalId::Type> >::const_iterator iter = mIndex.find (id2);
if (iter!=mIndex.end())
if (iter==mIndex.end())
return std::make_pair (-1, CSMWorld::UniversalId::Type_None);
return iter->second;

Loading…
Cancel
Save