Fixed return value of ArgumentParser::find() for when the search string is not found, the correct value is now -1.

This commit is contained in:
Robert Osfield
2008-11-05 11:56:44 +00:00
parent 822b1c9566
commit 766dcf4aeb
2 changed files with 2 additions and 2 deletions

View File

@@ -230,7 +230,7 @@ int ArgumentParser::find(const std::string& str) const
return pos; return pos;
} }
} }
return 0; return -1;
} }
bool ArgumentParser::match(int pos, const std::string& str) const bool ArgumentParser::match(int pos, const std::string& str) const

View File

@@ -401,7 +401,7 @@ void DisplaySettings::readCommandLine(ArgumentParser& arguments)
} }
int pos; int pos;
while ((pos=arguments.find("--stereo"))!=0) while ((pos=arguments.find("--stereo"))>0)
{ {
if (arguments.match(pos+1,"ANAGLYPHIC")) { arguments.remove(pos,2); _stereo = true;_stereoMode = ANAGLYPHIC; } if (arguments.match(pos+1,"ANAGLYPHIC")) { arguments.remove(pos,2); _stereo = true;_stereoMode = ANAGLYPHIC; }
else if (arguments.match(pos+1,"QUAD_BUFFER")) { arguments.remove(pos,2); _stereo = true;_stereoMode = QUAD_BUFFER; } else if (arguments.match(pos+1,"QUAD_BUFFER")) { arguments.remove(pos,2); _stereo = true;_stereoMode = QUAD_BUFFER; }