1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 22:45:34 +00:00

Use emplace instead of find-assign

This commit is contained in:
bzzt 2019-02-20 13:37:00 +00:00 committed by Capostrophic
parent 5bce3cbc68
commit a567111400
2 changed files with 2 additions and 7 deletions

View file

@ -244,10 +244,8 @@ namespace NifOsg
osg::ref_ptr<NifOsg::KeyframeController> callback(new NifOsg::KeyframeController(key->data.getPtr())); osg::ref_ptr<NifOsg::KeyframeController> callback(new NifOsg::KeyframeController(key->data.getPtr()));
callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key))); callback->setFunction(std::shared_ptr<NifOsg::ControllerFunction>(new NifOsg::ControllerFunction(key)));
if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end()) if (!target.mKeyframeControllers.emplace(strdata->string, callback).second)
Log(Debug::Verbose) << "Controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version"; Log(Debug::Verbose) << "Controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version";
else
target.mKeyframeControllers[strdata->string] = callback;
} }
} }

View file

@ -61,10 +61,7 @@ namespace SceneUtil
{ {
// Take transformation for first found node in file // Take transformation for first found node in file
const std::string nodeName = Misc::StringUtils::lowerCase(trans.getName()); const std::string nodeName = Misc::StringUtils::lowerCase(trans.getName());
if (mMap.find(nodeName) == mMap.end()) mMap.emplace(nodeName, &trans);
{
mMap[nodeName] = &trans;
}
traverse(trans); traverse(trans);
} }