Moves from using dStrCmp to the new String::compare static functions. Keeps things cleaner, consistent, and works with intellisense.

This commit is contained in:
Lukas Aldershaab 2020-10-03 14:37:55 +02:00
parent 76c5e30869
commit c999baf7ed
68 changed files with 168 additions and 144 deletions

View file

@ -315,7 +315,7 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
{
bool allowed = (_isDirInMainDotCsPath(value) || matchesFilters(value));
Item *exists = parent->findChildByValue( szValue );
if( allowed && !exists && dStrcmp( curPos, "" ) != 0 )
if( allowed && !exists && String::compare( curPos, "" ) != 0 )
{
// Since we're adding a child this parent can't be a virtual parent, so clear that flag
parent->setVirtualParent( false );
@ -357,7 +357,7 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path )
}
if( delim )
{
if( ( dStrcmp( delim, "" ) == 0 ) && item )
if( ( String::compare( delim, "" ) == 0 ) && item )
{
item->setExpanded( false );
if( parent && _hasChildren( item->getValue() ) )

View file

@ -408,7 +408,7 @@ bool GuiGameListOptionsCtrl::selectOption(S32 rowIndex, const char * theOption)
for (Vector<StringTableEntry>::iterator anOption = row->mOptions.begin(); anOption < row->mOptions.end(); ++anOption)
{
if (dStrcmp(*anOption, theOption) == 0)
if (String::compare(*anOption, theOption) == 0)
{
S32 newIndex = anOption - row->mOptions.begin();
row->mSelectedOption = newIndex;

View file

@ -513,7 +513,7 @@ S32 GuiListBoxCtrl::findItemText( StringTableEntry text, bool caseSensitive )
for( S32 i = 0; i < mItems.size(); i++ )
{
// Case Sensitive Compare?
if( caseSensitive && ( dStrcmp( mItems[i]->itemText, text ) == 0 ) )
if( caseSensitive && ( String::compare( mItems[i]->itemText, text ) == 0 ) )
return i;
else if (!caseSensitive && ( dStricmp( mItems[i]->itemText, text ) == 0 ))
return i;
@ -1584,7 +1584,7 @@ void GuiListBoxCtrl::addFilteredItem( String item )
for ( S32 i = 0; i < mSelectedItems.size(); i++ )
{
String itemText = mSelectedItems[i]->itemText;
if ( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
if ( String::compare( itemText.c_str(), item.c_str() ) == 0 )
{
mSelectedItems.erase_fast( i );
break;
@ -1594,7 +1594,7 @@ void GuiListBoxCtrl::addFilteredItem( String item )
for ( S32 i = 0; i < mItems.size(); i++ )
{
String itemText = mItems[i]->itemText;
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
if( String::compare( itemText.c_str(), item.c_str() ) == 0 )
{
mItems[i]->isSelected = false;
mFilteredItems.push_front( mItems[i] );
@ -1627,7 +1627,7 @@ void GuiListBoxCtrl::removeFilteredItem( String item )
for ( S32 i = 0; i < mFilteredItems.size(); i++ )
{
String itemText = mFilteredItems[i]->itemText;
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
if( String::compare( itemText.c_str(), item.c_str() ) == 0 )
{
mItems.push_front( mFilteredItems[i] );
mFilteredItems.erase( &mFilteredItems[i] );

View file

@ -629,7 +629,7 @@ void GuiPopUpMenuCtrl::addEntry( const char *buf, S32 id, U32 scheme )
// Ensure that there are no other entries with exactly the same name
for ( U32 i = 0; i < mEntries.size(); i++ )
{
if ( dStrcmp( mEntries[i].buf, buf ) == 0 )
if ( String::compare( mEntries[i].buf, buf ) == 0 )
return;
}
@ -745,7 +745,7 @@ S32 GuiPopUpMenuCtrl::findText( const char* text )
{
for ( U32 i = 0; i < mEntries.size(); i++ )
{
if ( dStrcmp( text, mEntries[i].buf ) == 0 )
if ( String::compare( text, mEntries[i].buf ) == 0 )
return( mEntries[i].id );
}
return( -1 );

View file

@ -832,7 +832,7 @@ void GuiPopUpMenuCtrlEx::addEntry(const char *buf, S32 id, U32 scheme)
// Ensure that there are no other entries with exactly the same name
for ( U32 i = 0; i < mEntries.size(); i++ )
{
if ( dStrcmp( mEntries[i].buf, buf ) == 0 )
if ( String::compare( mEntries[i].buf, buf ) == 0 )
return;
}
@ -930,7 +930,7 @@ S32 GuiPopUpMenuCtrlEx::findText( const char* text )
{
for ( U32 i = 0; i < mEntries.size(); i++ )
{
if ( dStrcmp( text, mEntries[i].buf ) == 0 )
if ( String::compare( text, mEntries[i].buf ) == 0 )
return( mEntries[i].id );
}
return( -1 );

View file

@ -239,7 +239,7 @@ void GuiTextEditCtrl::updateHistory( StringBuffer *inTxt, bool moveIndex )
return;
// see if it's already in
if(mHistoryLast == -1 || dStrcmp(txt, mHistoryBuf[mHistoryLast]))
if(mHistoryLast == -1 || String::compare(txt, mHistoryBuf[mHistoryLast]))
{
if(mHistoryLast == mHistorySize-1) // we're at the history limit... shuffle the pointers around:
{

View file

@ -4372,7 +4372,7 @@ S32 GuiTreeViewCtrl::findItemByName(const char *name)
continue;
if( mItems[i]->mState.test( Item::InspectorData ) )
continue;
if (mItems[i] && dStrcmp(mItems[i]->getText(),name) == 0)
if (mItems[i] && String::compare(mItems[i]->getText(),name) == 0)
return mItems[i]->mId;
}
@ -4389,7 +4389,7 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name)
continue;
if( mItems[i]->mState.test( Item::InspectorData ) )
continue;
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
if (mItems[i] && String::compare(mItems[i]->getValue(),name) == 0)
return mItems[i]->mId;
}
@ -5330,7 +5330,7 @@ DefineEngineMethod( GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, co
"@param delimiter (Optional) delimiter to use between each branch concatenation."
"@return text from the current node to the root.")
{
if (!dStrcmp(delimiter, "" ))
if (!String::compare(delimiter, "" ))
{
Con::warnf("GuiTreeViewCtrl::getTextToRoot - Invalid number of arguments!");
return ("");

View file

@ -692,7 +692,7 @@ bool GuiControl::onAdd()
const char *cName = getClassName();
// if we're a pure GuiControl, then we're a container by default.
if ( dStrcmp( "GuiControl", cName ) == 0 )
if ( String::compare( "GuiControl", cName ) == 0 )
mIsContainer = true;
// Add to root group.

View file

@ -70,7 +70,7 @@ void GuiInspectorDynamicField::setData( const char* data, bool callbacks )
const char *oldData = target->getDataField( mDynField->slotName, NULL );
if ( !oldData )
oldData = "";
if ( dStrcmp( oldData, data ) != 0 )
if ( String::compare( oldData, data ) != 0 )
{
target->inspectPreApply();

View file

@ -648,7 +648,7 @@ bool GuiInspectorField::hasSameValueInAllObjects()
if( !value2 )
value2 = "";
if( dStrcmp( value1, value2 ) != 0 )
if( String::compare( value1, value2 ) != 0 )
return false;
}

View file

@ -132,7 +132,7 @@ bool GuiConvexEditorCtrl::onWake()
SimGroup::iterator itr = scene->begin();
for ( ; itr != scene->end(); itr++ )
{
if ( dStrcmp( (*itr)->getClassName(), "ConvexShape" ) == 0 )
if ( String::compare( (*itr)->getClassName(), "ConvexShape" ) == 0 )
{
mConvexSEL = static_cast<ConvexShape*>( *itr );
mGizmo->set( mConvexSEL->getTransform(), mConvexSEL->getPosition(), mConvexSEL->getScale() );

View file

@ -881,7 +881,7 @@ DefineEngineMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" )
DefineEngineMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" )
{
if( dStrcmp( dbFrom, "" ) != 0 && dStrcmp( dbTo, "" ) != 0 )
if( String::compare( dbFrom, "" ) != 0 && String::compare( dbTo, "" ) != 0 )
object->retargetDecalDatablock( dbFrom, dbTo );
}

View file

@ -97,7 +97,7 @@ void GuiMissionAreaEditorCtrl::setSelectedMissionArea( MissionArea *missionArea
DefineEngineMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" )
{
if ( dStrcmp( missionAreaName, "" )==0 )
if ( String::compare( missionAreaName, "" )==0 )
object->setSelectedMissionArea(NULL);
else
{

View file

@ -867,7 +867,7 @@ bool TerrainEditor::isMainTile(const GridPoint & gPoint) const
const S32 blockSize = (S32)gPoint.terrainBlock->getBlockSize();
Point2I testPos = gPoint.gridPos;
if (!dStrcmp(getCurrentAction(),"paintMaterial"))
if (!String::compare(getCurrentAction(),"paintMaterial"))
{
if (testPos.x == blockSize)
testPos.x--;
@ -1181,7 +1181,7 @@ TerrainBlock* TerrainEditor::collide(const Gui3DMouseEvent & evt, Point3F & pos)
if (mTerrainBlocks.size() == 0)
return NULL;
if ( mMouseDown && !dStrcmp(getCurrentAction(),"paintMaterial") )
if ( mMouseDown && !String::compare(getCurrentAction(),"paintMaterial") )
{
if ( !mActiveTerrain )
return NULL;
@ -1780,7 +1780,7 @@ void TerrainEditor::on3DMouseDown(const Gui3DMouseEvent & event)
if(mTerrainBlocks.size() == 0)
return;
if (!dStrcmp(getCurrentAction(),"paintMaterial"))
if (!String::compare(getCurrentAction(),"paintMaterial"))
{
Point3F pos;
TerrainBlock* hitTerrain = collide(event, pos);
@ -1805,7 +1805,7 @@ void TerrainEditor::on3DMouseDown(const Gui3DMouseEvent & event)
return;
}
}
else if ((event.modifier & SI_ALT) && !dStrcmp(getCurrentAction(),"setHeight"))
else if ((event.modifier & SI_ALT) && !String::compare(getCurrentAction(),"setHeight"))
{
// Set value to terrain height at mouse position
GridInfo info;
@ -1847,7 +1847,7 @@ void TerrainEditor::on3DMouseMove(const Gui3DMouseEvent & event)
// We do not change the active terrain as the mouse moves when
// in painting mode. This is because it causes the material
// window to change as you cursor over to it.
if ( dStrcmp(getCurrentAction(),"paintMaterial") != 0 )
if ( String::compare(getCurrentAction(),"paintMaterial") != 0 )
{
// Set the active terrain
bool changed = mActiveTerrain != hitTerrain;
@ -2028,7 +2028,7 @@ void TerrainEditor::getTerrainBlocksMaterialList(Vector<StringTableEntry>& list)
void TerrainEditor::setBrushType( const char *type )
{
if ( mMouseBrush && dStrcmp( mMouseBrush->getType(), type ) == 0 )
if ( mMouseBrush && String::compare( mMouseBrush->getType(), type ) == 0 )
return;
if(!dStricmp(type, "box"))
@ -2199,7 +2199,7 @@ void TerrainEditor::processAction(const char* sAction)
return;
TerrainAction * action = mCurrentAction;
if (dStrcmp(sAction, "") != 0)
if (String::compare(sAction, "") != 0)
{
action = lookupAction(sAction);