Avoid redundant conversion to lower case for CommandDispatcher::mSelection items

depth-refraction
elsid 2 years ago
parent 7daef583cb
commit 191f207e78
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -113,11 +113,7 @@ void CSMWorld::CommandDispatcher::setEditLock(bool locked)
void CSMWorld::CommandDispatcher::setSelection(const std::vector<std::string>& selection)
{
mSelection = selection;
for (auto& sel : mSelection)
{
Misc::StringUtils::lowerCaseInPlace(sel);
}
std::sort(mSelection.begin(), mSelection.end());
std::sort(mSelection.begin(), mSelection.end(), Misc::StringUtils::CiComp{});
}
void CSMWorld::CommandDispatcher::setExtendedTypes(const std::vector<UniversalId>& types)
@ -290,8 +286,7 @@ void CSMWorld::CommandDispatcher::executeExtendedDelete()
if (record.mState == RecordBase::State_Deleted)
continue;
if (!std::binary_search(mSelection.begin(), mSelection.end(),
Misc::StringUtils::lowerCase(record.get().mCell.getRefIdString())))
if (!std::binary_search(mSelection.begin(), mSelection.end(), record.get().mCell))
continue;
macro.push(new CSMWorld::DeleteCommand(model, record.get().mId.getRefIdString()));
@ -321,8 +316,7 @@ void CSMWorld::CommandDispatcher::executeExtendedRevert()
{
const Record<CellRef>& record = collection.getRecord(i);
if (!std::binary_search(mSelection.begin(), mSelection.end(),
Misc::StringUtils::lowerCase(record.get().mCell.getRefIdString())))
if (!std::binary_search(mSelection.begin(), mSelection.end(), record.get().mCell))
continue;
macro.push(new CSMWorld::RevertCommand(model, record.get().mId.getRefIdString()));

Loading…
Cancel
Save