case convert only the first parameter of a command (so that contstants in the 2nd and later params don't get munged)

This commit is contained in:
Chris Danford
2004-11-06 03:51:06 +00:00
parent c8a252ee77
commit 4b29db0667
2 changed files with 11 additions and 9 deletions
+1 -6
View File
@@ -618,13 +618,8 @@ void Actor::AddRotationR( float rot )
void Actor::Command( const CString &sCommands )
{
// Convert to lower so we can do case insensitive compared later.
// TODO: Is this the best place to convert?
CString sCommandsLower = sCommands;
sCommandsLower.MakeLower();
vector<ParsedCommand> vCommands;
ParseCommands( sCommandsLower, vCommands );
ParseCommands( sCommands, vCommands );
for( unsigned i=0; i<vCommands.size(); i++ )
this->HandleCommand( vCommands[i] );
+10 -3
View File
@@ -28,10 +28,17 @@ void ParsedCommand::Set( const CString &sCommand )
vTokens.resize( vsTokens.size() );
for( unsigned j=0; j<vsTokens.size(); j++ )
for( unsigned i=0; i<vsTokens.size(); i++ )
{
const CString &sToken = vsTokens[j];
vTokens[j].Set( sToken );
CString &sToken = vsTokens[i];
// TRICKY: The first parameter is the command name. This is case
// insensitive. Convert it to lowercase now so that we can do
// case sensitive compares later.
if( i == 0 )
sToken.MakeLower();
vTokens[i].Set( sToken );
}
}