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

@ -403,7 +403,7 @@ void AIClient::onAdd( const char *nameSpace ) {
// This doesn't work...
//
if( dStrcmp( nameSpace, mNameSpace->mName ) ) {
if( String::compare( nameSpace, mNameSpace->mName ) ) {
Con::linkNamespaces( mNameSpace->mName, nameSpace );
mNameSpace = Con::lookupNamespace( nameSpace );
}
@ -547,7 +547,7 @@ DefineEngineFunction( aiAddPlayer, S32, (const char * name, const char * ns), ("
aiPlayer->onConnect_callback( name );
// Now execute the onAdd command and feed it the namespace
if(dStrcmp( ns,"" ) != 0 )
if(String::compare( ns,"" ) != 0 )
aiPlayer->onAdd( ns );
else
aiPlayer->onAdd( "AIClient" );

View file

@ -1108,11 +1108,11 @@ DefineEngineMethod(AIPlayer, getNavMesh, S32, (),,
DefineEngineMethod(AIPlayer, setNavSize, void, (const char *size),,
"@brief Set the size of NavMesh this character uses. One of \"Small\", \"Regular\" or \"Large\".")
{
if(!dStrcmp(size, "Small"))
if(!String::compare(size, "Small"))
object->setNavSize(AIPlayer::Small);
else if(!dStrcmp(size, "Regular"))
else if(!String::compare(size, "Regular"))
object->setNavSize(AIPlayer::Regular);
else if(!dStrcmp(size, "Large"))
else if(!String::compare(size, "Large"))
object->setNavSize(AIPlayer::Large);
else
Con::errorf("AIPlayer::setNavSize: no such size '%s'.", size);

View file

@ -209,7 +209,7 @@ void fxShapeReplicator::CreateShapes(void)
if (mFieldData.mHideReplications) return;
// Cannot continue without shapes!
if (dStrcmp(mFieldData.mShapeFile, "") == 0) return;
if (String::compare(mFieldData.mShapeFile, "") == 0) return;
// Check that we can position somewhere!
if (!( mFieldData.mAllowOnTerrain ||

View file

@ -454,7 +454,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
U32 currentProtocol, minProtocol;
char gameString[256];
stream->readString(gameString);
if(dStrcmp(gameString, TORQUE_APP_NAME))
if(String::compare(gameString, TORQUE_APP_NAME))
{
*errorString = "CHR_GAME";
return false;
@ -481,7 +481,7 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
const char *serverPassword = Con::getVariable("pref::Server::Password");
if(serverPassword[0])
{
if(dStrcmp(joinPassword, serverPassword))
if(String::compare(joinPassword, serverPassword))
{
*errorString = "CHR_PASSWORD";
return false;

View file

@ -191,7 +191,7 @@ void SimDataBlockEvent::unpack(NetConnection *cptr, BitStream *bstream)
// An object with the given ID already exists. Make sure it has the right class.
AbstractClassRep* classRep = AbstractClassRep::findClassRep( cptr->getNetClassGroup(), NetClassTypeDataBlock, classId );
if( classRep && dStrcmp( classRep->getClassName(), ptr->getClassName() ) != 0 )
if( classRep && String::compare( classRep->getClassName(), ptr->getClassName() ) != 0 )
{
Con::warnf( "A '%s' datablock with id: %d already existed. "
"Clobbering it with new '%s' datablock from server.",

View file

@ -2416,7 +2416,7 @@ void Player::getDamageLocation(const Point3F& in_rPos, const char *&out_rpVert,
else
out_rpVert = "head";
if(dStrcmp(out_rpVert, "head") != 0)
if(String::compare(out_rpVert, "head") != 0)
{
if (newPoint.y >= 0.0f)
{