and fix a ton more minor performance issues

This commit is contained in:
DarthArgus
2014-10-27 22:39:57 -07:00
parent 14eaf713d0
commit c9c39d5713
97 changed files with 266 additions and 376 deletions
@@ -45,7 +45,7 @@ void DataTableManager::remove()
{
FATAL(!m_installed, ("DataTableManager::remove: not installed."));
m_cachedTable = 0;
m_cachedTableName = "";
m_cachedTableName.clear();
std::map<std::string, DataTable *>::iterator i;
for (i=m_tables.begin(); i != m_tables.end(); ++i)
@@ -103,7 +103,7 @@ void DataTableManager::close(const std::string& table)
if (m_cachedTable == i->second)
{
DEBUG_WARNING(m_cachedTableName != table, ("Cached name got out of sync"));
m_cachedTableName = "";
m_cachedTableName.clear();
m_cachedTable = 0;
}
@@ -589,7 +589,7 @@ void DataTableWriter::_loadFromSpreadsheetTab(const char * filename)
bool DataTableWriter::save(const char * outputFileName, bool optional) const
{
if (!outputFileName || strlen(outputFileName) == 0)
if (!outputFileName || outputFileName[0] != '\0')
{
DEBUG_FATAL(true, ("OutputFileName is NULL or empty."));
return false;
@@ -1038,7 +1038,7 @@ bool DataTableWriter::saveTable( const char* tableName, const char* fileName, bo
if (i != m_tables.end())
{
if (!fileName || strlen(fileName) == 0)
if (!fileName || fileName[0] != '\0')
{
std::string outputFile;
getTableOutputFileName((*i)->getName().c_str(), outputFile);
@@ -240,7 +240,7 @@ void FileName::stripSpecificPathAndExt (Path path, char* nameBuffer, int nameBuf
//correct path, now check extension.
//first make sure this path has an extension
if (strlen(pathTable[path].ext) > 0)
if (pathTable[path].ext[0] != '\0')
{
end = strrchr(nameBuffer, '.');
//make sure to compare strings starting just after the dot
@@ -202,8 +202,7 @@ void LocationManager::setPlanetName (char const * const planetName)
char fileName [256];
sprintf (fileName, "terrain/%s.trn", planetName);
if (ms_bakedTerrain)
delete ms_bakedTerrain;
delete ms_bakedTerrain;
ms_bakedTerrain = BakedTerrainReader::create (fileName);
}
@@ -138,7 +138,7 @@ RotaryCache::getNext()
{
void* retVal = (*mIterList).value;
mIterList++;
++mIterList;
return retVal;
}