diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index 1519e4456..76a8fdc84 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -484,14 +484,14 @@ int ObjFileParser::getMaterialIndex( const std::string &strMaterialName ) int mat_index = -1; if ( strMaterialName.empty() ) return mat_index; - for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index) + for (size_t index = 0; index < m_pModel->m_MaterialLib.size(); ++index) + { + if ( strMaterialName == m_pModel->m_MaterialLib[ index ]) { - if ( strMaterialName == m_pModel->m_MaterialLib[ index ]) - { - mat_index = (int)index; - break; - } + mat_index = (int)index; + break; } + } return mat_index; } @@ -591,12 +591,12 @@ void ObjFileParser::createObject(const std::string &strObjectName) m_pModel->m_pCurrent = new ObjFile::Object(); m_pModel->m_pCurrent->m_strObjName = strObjectName; - m_pModel->m_Objects.push_back(m_pModel->m_pCurrent); + m_pModel->m_Objects.push_back( m_pModel->m_pCurrent ); m_pModel->m_pCurrentMesh = new ObjFile::Mesh(); m_pModel->m_Meshes.push_back( m_pModel->m_pCurrentMesh ); - if(m_pModel->m_pCurrentMaterial) + if( m_pModel->m_pCurrentMaterial ) { m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( m_pModel->m_pCurrentMaterial->MaterialName.data ); diff --git a/code/ObjTools.h b/code/ObjTools.h index ac8c6f275..ac9a8986c 100644 --- a/code/ObjTools.h +++ b/code/ObjTools.h @@ -93,7 +93,7 @@ inline Char_T getNextWord( Char_T pBuffer, Char_T pEnd ) { while ( !isEndOfBuffer( pBuffer, pEnd ) ) { - if ( !isSeparator( *pBuffer ) ) + if ( !isSeparator( *pBuffer ) || isNewLine( *pBuffer ) ) break; pBuffer++; } @@ -126,7 +126,7 @@ inline Char_T getNextToken( Char_T pBuffer, Char_T pEnd ) template inline char_t skipLine( char_t it, char_t end, unsigned int &uiLine ) { - while ( !isEndOfBuffer( it, end ) && *it != '\n' ) + while ( !isEndOfBuffer( it, end ) && !isNewLine( *it ) ) ++it; if ( it != end ) {