diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index f805bfb9a..3bad8c963 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -1000,6 +1000,22 @@ void XFileParser::CheckForSeparator() ThrowException( "Separator character (';' or ',') expected."); } +// ------------------------------------------------------------------------------------------------ +// tests and possibly consumes a separator char, but does nothing if there was no separator +void XFileParser::TestForSeparator() +{ + if( mIsBinaryFormat) + return; + + FindNextNoneWhiteSpace(); + if( P >= End) + return; + + // test and skip + if( *P == ';' || *P == ',') + P++; +} + // ------------------------------------------------------------------------------------------------ void XFileParser::readHeadOfDataObject( std::string* poName) { @@ -1332,7 +1348,7 @@ aiVector2D XFileParser::ReadVector2() aiVector2D vector; vector.x = ReadFloat(); vector.y = ReadFloat(); - CheckForSeparator(); + TestForSeparator(); return vector; } @@ -1344,7 +1360,7 @@ aiVector3D XFileParser::ReadVector3() vector.x = ReadFloat(); vector.y = ReadFloat(); vector.z = ReadFloat(); - CheckForSeparator(); + TestForSeparator(); return vector; } @@ -1357,7 +1373,7 @@ aiColor4D XFileParser::ReadRGBA() color.g = ReadFloat(); color.b = ReadFloat(); color.a = ReadFloat(); - CheckForSeparator(); + TestForSeparator(); return color; } @@ -1369,7 +1385,7 @@ aiColor3D XFileParser::ReadRGB() color.r = ReadFloat(); color.g = ReadFloat(); color.b = ReadFloat(); - CheckForSeparator(); + TestForSeparator(); return color; } diff --git a/code/XFileParser.h b/code/XFileParser.h index b21af1bd3..9f1ec6f33 100644 --- a/code/XFileParser.h +++ b/code/XFileParser.h @@ -116,6 +116,9 @@ protected: //! checks for a separator char, either a ',' or a ';' void CheckForSeparator(); + /// tests and possibly consumes a separator char, but does nothing if there was no separator + void TestForSeparator(); + //! reads a x file style string void GetNextTokenAsString( std::string& poString);