Optimize some std::string usages.

This commit is contained in:
Kim Kulling
2018-03-20 18:43:54 +01:00
parent 9febb392d8
commit 5814e6f9f0
15 changed files with 72 additions and 64 deletions

View File

@@ -267,7 +267,9 @@ void Parser::Parse()
// at the file extension (ASE, ASK, ASC)
// *************************************************************
if (fmt)iFileFormat = fmt;
if ( fmt ) {
iFileFormat = fmt;
}
continue;
}
// main scene information
@@ -427,28 +429,25 @@ void Parser::ParseLV1SoftSkinBlock()
// Reserve enough storage
vert.mBoneWeights.reserve(numWeights);
for (unsigned int w = 0; w < numWeights;++w)
{
std::string bone;
std::string bone;
for (unsigned int w = 0; w < numWeights;++w) {
bone.clear();
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");
// Find the bone in the mesh's list
std::pair<int,ai_real> me;
me.first = -1;
for (unsigned int n = 0; n < curMesh->mBones.size();++n)
{
if (curMesh->mBones[n].mName == bone)
{
for (unsigned int n = 0; n < curMesh->mBones.size();++n) {
if (curMesh->mBones[n].mName == bone) {
me.first = n;
break;
}
}
if (-1 == me.first)
{
if (-1 == me.first) {
// We don't have this bone yet, so add it to the list
me.first = (int)curMesh->mBones.size();
curMesh->mBones.push_back(ASE::Bone(bone));
me.first = static_cast<int>( curMesh->mBones.size() );
curMesh->mBones.push_back( ASE::Bone( bone ) );
}
ParseLV4MeshFloat( me.second );
@@ -745,6 +744,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
// empty the texture won't be used later.
// ***********************************************************
bool parsePath = true;
std::string temp;
while (true)
{
if ('*' == *filePtr)
@@ -753,7 +753,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
// type of map
if (TokenMatch(filePtr,"MAP_CLASS" ,9))
{
std::string temp;
temp.clear();
if(!ParseString(temp,"*MAP_CLASS"))
SkipToNextToken();
if (temp != "Bitmap" && temp != "Normal Bump")