From d790b8edfa5d41107fb5f55e3eecf0455679f660 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Sat, 27 Sep 2014 23:39:22 +1000 Subject: [PATCH] Revert old fix. --- apps/opencs/model/world/collection.hpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/apps/opencs/model/world/collection.hpp b/apps/opencs/model/world/collection.hpp index 387b33cf3..1fb3e1f1d 100644 --- a/apps/opencs/model/world/collection.hpp +++ b/apps/opencs/model/world/collection.hpp @@ -7,7 +7,6 @@ #include #include #include -#include #include @@ -432,27 +431,18 @@ namespace CSMWorld const Record& record2 = dynamic_cast&> (record); - std::pair::iterator, bool> insertResult = - mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (IdAccessorT().getId (record2.get())), - index)); - - if(!insertResult.second) // duplicate index found, replace the current record - { - std::cerr << "Duplicate record found, using new: " + IdAccessorT().getId(record2.get()) << std::endl; - replace(insertResult.first->second, record2); - return; - } + mRecords.insert (mRecords.begin()+index, record2); - // else update the index except for the record to be inserted if (index (mRecords.size())-1) { - std::string id = IdAccessorT().getId(record2.get()); - for (std::map::iterator iter (mIndex.begin()); iter!=mIndex.end(); ++iter) - if (iter->second > index || (iter->second == index && iter->first != id)) + for (std::map::iterator iter (mIndex.begin()); iter!=mIndex.end(); + ++iter) + if (iter->second>=index) ++(iter->second); } - mRecords.insert (mRecords.begin()+index, record2); + mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (IdAccessorT().getId ( + record2.get())), index)); } template