LWO: Use C++11 range-based for loop

This commit is contained in:
Turo Lamminen
2016-05-23 17:30:42 +03:00
parent 3031470ec1
commit b9fbfbc18a
2 changed files with 29 additions and 32 deletions
+6 -7
View File
@@ -246,8 +246,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
apcMeshes.reserve(mLayers->size()*std::min(((unsigned int)mSurfaces->size()/2u), 1u));
unsigned int iDefaultSurface = UINT_MAX; // index of the default surface
for (LayerList::iterator lit = mLayers->begin(), lend = mLayers->end();lit != lend;++lit) {
LWO::Layer& layer = *lit;
for (LWO::Layer &layer : *mLayers) {
if (layer.skip)
continue;
@@ -909,12 +908,12 @@ void LWOImporter::LoadLWO2PolygonTags(unsigned int length)
template <class T>
VMapEntry* FindEntry(std::vector< T >& list,const std::string& name, bool perPoly)
{
for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end; ++it) {
if ((*it).name == name) {
for (auto & elem : list) {
if (elem.name == name) {
if (!perPoly) {
DefaultLogger::get()->warn("LWO2: Found two VMAP sections with equal names");
}
return &(*it);
return &elem;
}
}
list.push_back( T() );
@@ -941,8 +940,8 @@ inline void CreateNewEntry(T& chan, unsigned int srcIdx)
template <class T>
inline void CreateNewEntry(std::vector< T >& list, unsigned int srcIdx)
{
for (typename std::vector< T >::iterator it = list.begin(), end = list.end();it != end;++it) {
CreateNewEntry( *it, srcIdx );
for (auto &elem : list) {
CreateNewEntry( elem, srcIdx );
}
}