本文整理汇总了C++中idStr::Icmp方法的典型用法代码示例。如果您正苦于以下问题:C++ idStr::Icmp方法的具体用法?C++ idStr::Icmp怎么用?C++ idStr::Icmp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idStr
的用法示例。
在下文中一共展示了idStr::Icmp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseToken
/*
================
idCameraPosition::parseToken
================
*/
bool idCameraPosition::parseToken( const idStr &key, idParser *src ) {
idToken token;
if ( !key.Icmp( "time" ) ) {
time = src->ParseInt();
return true;
}
else if ( !key.Icmp( "type" ) ) {
type = static_cast<idCameraPosition::positionType> ( src->ParseInt() );
return true;
}
else if ( !key.Icmp( "velocity" ) ) {
long t = atol(token);
long d = src->ParseInt();
float s = src->ParseFloat();
addVelocity(t, d, s);
return true;
}
else if ( !key.Icmp( "baseVelocity" ) ) {
baseVelocity = src->ParseFloat();
return true;
}
else if ( !key.Icmp( "name" ) ) {
src->ReadToken( &token );
name = token;
return true;
}
else {
src->Error( "unknown camera position key: %s", key.c_str() );
return false;
}
}
示例2: FindItem
/*
================
CPathTreeCtrl::FindItem
Find the given path in the tree.
================
*/
HTREEITEM CPathTreeCtrl::FindItem( const idStr &pathName ) {
int lastSlash;
idStr path, tmpPath, itemName;
HTREEITEM item, parentItem;
parentItem = NULL;
item = GetRootItem();
lastSlash = pathName.Last( '/' );
while( item && lastSlash > path.Length() ) {
itemName = GetItemText( item );
tmpPath = path + itemName;
if ( pathName.Icmpn( tmpPath, tmpPath.Length() ) == 0 ) {
parentItem = item;
item = GetChildItem( item );
path = tmpPath + "/";
} else {
item = GetNextSiblingItem( item );
}
}
for ( item = GetChildItem( parentItem ); item; item = GetNextSiblingItem( item ) ) {
itemName = GetItemText( item );
if ( pathName.Icmp( path + itemName ) == 0 ) {
return item;
}
}
return NULL;
}
示例3: Init
/*
============
idAASLocal::Init
============
*/
bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
if ( file && mapName.Icmp( file->GetName() ) == 0 && mapFileCRC == file->GetCRC() ) {
gameLocal.Printf( "Keeping %s\n", file->GetName() );
RemoveAllObstacles();
}
else {
Shutdown();
file = AASFileManager->LoadAAS( mapName, mapFileCRC );
if ( !file ) {
common->DWarning( "Couldn't load AAS file: '%s'", mapName.c_str() );
return false;
}
// RAVEN BEGIN
// rhummer: Check if this is a dummy file, since it really has no valid data dump it.
else if ( file->IsDummyFile( mapFileCRC ) ) {
AASFileManager->FreeAAS( file );
file = NULL;
return false;
}
// RAVEN END
SetupRouting();
}
return true;
}
示例4: Set
/*
============
idInternalCVar::Set
============
*/
void idInternalCVar::Set( const char *newValue, bool force, bool fromServer )
{
if ( session && session->IsMultiplayer() && !fromServer )
{
#ifndef ID_TYPEINFO
if ( ( flags & CVAR_NETWORKSYNC ) && idAsyncNetwork::client.IsActive() )
{
common->Printf( "%s is a synced over the network and cannot be changed on a multiplayer client.\n", nameString.c_str() );
#if ID_ALLOW_CHEATS
common->Printf( "ID_ALLOW_CHEATS override!\n" );
#else
return;
#endif
}
#endif
if ( ( flags & CVAR_CHEAT ) && !cvarSystem->GetCVarBool( "net_allowCheats" ) )
{
common->Printf( "%s cannot be changed in multiplayer.\n", nameString.c_str() );
#if ID_ALLOW_CHEATS
common->Printf( "ID_ALLOW_CHEATS override!\n" );
#else
return;
#endif
}
}
if ( !newValue )
{
newValue = resetString.c_str();
}
if ( !force )
{
if ( flags & CVAR_ROM )
{
common->Printf( "%s is read only.\n", nameString.c_str() );
return;
}
if ( flags & CVAR_INIT )
{
common->Printf( "%s is write protected.\n", nameString.c_str() );
return;
}
}
if ( valueString.Icmp( newValue ) == 0 )
{
return;
}
valueString = newValue;
value = valueString.c_str();
UpdateValue();
SetModified();
cvarSystem->SetModifiedFlags( flags );
}
示例5: Update
/*
============
idInternalCVar::Update
============
*/
void idInternalCVar::Update( const idCVar *cvar )
{
// if this is a statically declared variable
if ( cvar->GetFlags() & CVAR_STATIC )
{
if ( flags & CVAR_STATIC )
{
// the code has more than one static declaration of the same variable, make sure they have the same properties
if ( resetString.Icmp( cvar->GetString() ) != 0 )
{
common->Warning( "CVar '%s' declared multiple times with different initial value", nameString.c_str() );
}
if ( ( flags & (CVAR_BOOL|CVAR_INTEGER|CVAR_FLOAT) ) != ( cvar->GetFlags() & (CVAR_BOOL|CVAR_INTEGER|CVAR_FLOAT) ) )
{
common->Warning( "CVar '%s' declared multiple times with different type", nameString.c_str() );
}
if ( valueMin != cvar->GetMinValue() || valueMax != cvar->GetMaxValue() )
{
common->Warning( "CVar '%s' declared multiple times with different minimum/maximum", nameString.c_str() );
}
}
// the code is now specifying a variable that the user already set a value for, take the new value as the reset value
resetString = cvar->GetString();
descriptionString = cvar->GetDescription();
description = descriptionString.c_str();
valueMin = cvar->GetMinValue();
valueMax = cvar->GetMaxValue();
Mem_Free( valueStrings );
valueStrings = CopyValueStrings( cvar->GetValueStrings() );
valueCompletion = cvar->GetValueCompletion();
UpdateValue();
cvarSystem->SetModifiedFlags( cvar->GetFlags() );
}
flags |= cvar->GetFlags();
UpdateCheat();
// only allow one non-empty reset string without a warning
if ( resetString.Length() == 0 )
{
resetString = cvar->GetString();
}
else if ( cvar->GetString()[0] && resetString.Cmp( cvar->GetString() ) != 0 )
{
common->Warning( "cvar \"%s\" given initial values: \"%s\" and \"%s\"\n", nameString.c_str(), resetString.c_str(), cvar->GetString() );
}
}
示例6: Init
/*
============
idAASLocal::Init
============
*/
bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
if( file && mapName.Icmp( file->GetName() ) == 0 && mapFileCRC == file->GetCRC() ) {
common->Printf( "Keeping %s\n", file->GetName() );
RemoveAllObstacles();
} else {
Shutdown();
file = AASFileManager->LoadAAS( mapName, mapFileCRC );
if( !file ) {
common->DWarning( "Couldn't load AAS file: '%s'", mapName.c_str() );
return false;
}
SetupRouting();
}
return true;
}
示例7: Init
/*
============
idAASLocal::Init
============
*/
bool idAASLocal::Init( const idStr &mapName, const unsigned int mapFileCRC ) {
// Clear the elevator system before reloading
elevatorSystem->Clear();
if ( file && mapName.Icmp( file->GetName() ) == 0 && mapFileCRC == file->GetCRC() ) {
common->Printf( "Keeping %s\n", file->GetName() );
RemoveAllObstacles();
}
else {
Shutdown();
file = AASFileManager->LoadAAS( mapName, mapFileCRC );
if ( !file ) {
common->DWarning( "Couldn't load AAS file: '%s'", mapName.c_str() );
return false;
}
mapName.ExtractFileExtension(name);
SetupRouting();
}
return true;
}
示例8: atoi
/*
============
idInternalCVar::UpdateValue
============
*/
void idInternalCVar::UpdateValue( void ) {
bool clamped = false;
if ( flags & CVAR_BOOL ) {
integerValue = ( atoi( value ) != 0 );
floatValue = integerValue;
if ( idStr::Icmp( value, "0" ) != 0 && idStr::Icmp( value, "1" ) != 0 ) {
valueString = idStr( (bool)( integerValue != 0 ) );
value = valueString.c_str();
}
} else if ( flags & CVAR_INTEGER ) {
integerValue = (int)atoi( value );
if ( valueMin < valueMax ) {
if ( integerValue < valueMin ) {
integerValue = (int)valueMin;
clamped = true;
} else if ( integerValue > valueMax ) {
integerValue = (int)valueMax;
clamped = true;
}
}
if ( clamped || !idStr::IsNumeric( value ) || idStr::FindChar( value, '.' ) ) {
valueString = idStr( integerValue );
value = valueString.c_str();
}
floatValue = (float)integerValue;
} else if ( flags & CVAR_FLOAT ) {
floatValue = (float)atof( value );
if ( valueMin < valueMax ) {
if ( floatValue < valueMin ) {
floatValue = valueMin;
clamped = true;
} else if ( floatValue > valueMax ) {
floatValue = valueMax;
clamped = true;
}
}
if ( clamped || !idStr::IsNumeric( value ) ) {
valueString = idStr( floatValue );
value = valueString.c_str();
}
integerValue = (int)floatValue;
} else {
if ( valueStrings && valueStrings[0] ) {
integerValue = 0;
for ( int i = 0; valueStrings[i]; i++ ) {
if ( valueString.Icmp( valueStrings[i] ) == 0 ) {
integerValue = i;
break;
}
}
valueString = valueStrings[integerValue];
value = valueString.c_str();
floatValue = (float)integerValue;
} else if ( valueString.Length() < 32 ) {
floatValue = (float)atof( value );
integerValue = (int)floatValue;
} else {
floatValue = 0.0f;
integerValue = 0;
}
}
}