Changed: Replaced string empty comparisons with empty()

This commit is contained in:
kervala 2012-10-06 17:17:26 +02:00
parent 97a39698b8
commit 94fbb51b90
15 changed files with 21 additions and 21 deletions

View file

@ -193,7 +193,7 @@ void SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, con
Mem = new uint8[NbW*Width*NbH*Height];
uint32 i, j;
if (filename == "")
if (filename.empty())
{
// No filename so init with default
for (i = 0; i < NbW; ++i)

View file

@ -307,7 +307,7 @@ void CCluster::serial (NLMISC::IStream&f)
_SoundGroupId = CStringMapper::map(soundGroup);
f.serial(envFxName);
if (envFxName == "")
if (envFxName.empty())
envFxName = "no fx";
_EnvironmentFxId = CStringMapper::map(envFxName);
}

View file

@ -237,7 +237,7 @@ void CZoneLoadingTask::run(void)
{
// Lookup the zone
string zonePathLookup = CPath::lookup (_ZoneName, false, false, true);
if (zonePathLookup == "")
if (zonePathLookup.empty())
zonePathLookup = _ZoneName;
CZone *ZoneTmp = new CZone;

View file

@ -89,7 +89,7 @@ void CVarPath::decode ()
string val = getToken ();
if (val == "")
if (val.empty())
return;
if (val == "[" )
@ -105,7 +105,7 @@ void CVarPath::decode ()
osbnb++;
// end of token
if (val == "")
if (val.empty())
{
nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str());
Destination.clear ();

View file

@ -142,7 +142,7 @@ public:
for (i=0; i<num; ++i)
{
std::string fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true);
if (fname == "")
if (fname.empty())
continue;
NLMISC::CIFile f(fname);

View file

@ -777,7 +777,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
sint32 dstPhraseId= pCSDst->getSPhraseId();
sint32 dstMacroId= pCSDst->getMacroId();
if ((src == "") && (CHandlerPhraseMemoryCopy::haveLastPhraseElement))
if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement))
{
// get the slot ids from save
srcIsMacro= CHandlerPhraseMemoryCopy::isMacro;

View file

@ -1563,7 +1563,7 @@ bool CInterfaceManager::loadConfig (const string &filename)
CIFile f;
string sFileName;
sFileName = NLMISC::CPath::lookup (filename, false);
if (sFileName == "" || !f.open(sFileName))
if (sFileName.empty() || !f.open(sFileName))
return false;

View file

@ -43,7 +43,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
{
CSString eff = pIS->Consumable.Properties[i];
if (eff == "")
if (eff.empty())
continue;
// Get name id of effect

View file

@ -1228,7 +1228,7 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
p = s.splitTo('.', true);
while (p.size() > 0)
{
if (path == "")
if (path.empty())
path = p;
else
path += "." + p;

View file

@ -707,7 +707,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
SGlobalTexture gt;
// Load texture file
string filename = CPath::lookup (textureFileName, false);
if (filename == "") return;
if (filename.empty()) return;
CIFile ifTmp;
if (ifTmp.open(filename))
CBitmap::loadSize (ifTmp, gt.Width, gt.Height);
@ -724,7 +724,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
// Load uv file
CIFile iFile;
filename = CPath::lookup (uvFileName, false);
if (filename == "") return;
if (filename.empty()) return;
if (!iFile.open(filename)) return;
_GlobalTextures.push_back (gt);
@ -866,7 +866,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName,
SGlobalTexture gtTmp;
gtTmp.FromGlobaleTexture = false;
string filename = CPath::lookup (sLwrGTName, false);
if (filename == "") return -1;
if (filename.empty()) return -1;
CIFile ifTmp;
if (ifTmp.open(filename))
{

View file

@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp)
return 0;
const string &strPos = GR->getIdentifier(gp);
if(strPos == "")
if(strPos.empty())
return 0;
// try to find the ig in the loaded ig map
std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos));

View file

@ -6603,7 +6603,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj)
CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/)
{
CObject *table;
if (instanceId == "")
if (instanceId.empty())
{
table = getEditor().getDMC().newComponent("Position");
table->set("x", vector.x);

View file

@ -470,7 +470,7 @@ protected:
/// display nodes
void xmlDisplay()
{
std::string ntype = (Name == "" ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch");
std::string ntype = (Name.empty() ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch");
nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str());

View file

@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index != -1);
instanceId = parent->getAttr("InstanceId")->toString();
attrName = parent->getKey(index);
if (attrName == "")
if (attrName.empty())
{
position = index;
}
@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index2 != -1);
sint32 index = parent->findIndex(this);
nlassert(index != -1);
if (parent2->getKey(index2) == "")
if (parent2->getKey(index2).empty())
{
nlassert(0); // TMP : want to see if may possibly happen
return false;
@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co
if ( _Value[i].second->isString("Name")
&& _Value[i].second->isString("LocationId")
&& _Value[i].second->toString("Name") == "Permanent"
&& _Value[i].second->toString("LocationId") == "")
&& _Value[i].second->toString("LocationId").empty())
{
isDefault = true;
}
@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
//H_AUTO(R2_CObjectTable_setObject)
CHECK_TABLE_INTEGRITY
value->setGhost(this->getGhost());
if (key == "")
if (key.empty())
{
clear();

View file

@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile()
nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str());
}
}
if(package == "")
if(package.empty())
nlinfo("no 'package' tag in %s island", island);
else
completeIsland.Package = CSString(package);