Core/Storage: A few more improvements to code style, corrected some engrish and fixed compile

This commit is contained in:
Shauren
2011-03-18 17:01:37 +01:00
parent 2f89fa9e69
commit d3425921f8
2 changed files with 31 additions and 35 deletions
@@ -198,7 +198,8 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
for (uint32 y = 0; y < recordCount; ++y) for (uint32 y = 0; y < recordCount; ++y)
{ {
uint32 ind = getRecord(y).getUInt(i); uint32 ind = getRecord(y).getUInt(i);
if (indi > maxi)maxi = ind; if (ind > maxi)
maxi = ind;
} }
// If higher index avalible from sql - use it instead of dbcs // If higher index avalible from sql - use it instead of dbcs
@@ -208,7 +209,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
++maxi; ++maxi;
records = maxi; records = maxi;
indexTable = new ptr[maxi]; indexTable = new ptr[maxi];
memset(indexTable, 0, imaxi * sizeof(ptr)); memset(indexTable, 0, maxi * sizeof(ptr));
} }
else else
{ {
@@ -306,7 +307,7 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
break; break;
} }
case FT_LOGIC: case FT_LOGIC:
assert(false && "Attempted to load DBC files that do not have field types that match what is in the core. Check DBCfmt.h or your DBC files."); assert(false && "Attempted to load DBC files that does not have field types that match what is in the core. Check DBCfmt.h or your DBC files.");
break; break;
case FT_NA: case FT_NA:
case FT_NA_BYTE: case FT_NA_BYTE:
@@ -321,4 +322,3 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
return stringPool; return stringPool;
} }
+4 -8
View File
@@ -140,11 +140,11 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
QueryResult result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table); QueryResult result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.entry_field, store.table);
if (!result) if (!result)
{ {
sLog->outError("Error loading %s table (not exist?)\n", store.table); sLog->outError("Error loading %s table (does not exist?)\n", store.table);
exit(1); // Stop server at loading non exited table or not accessable table exit(1); // Stop server at loading non exited table or not accessable table
} }
maxi = (*result)[0].GetUInt32() + 1; maxi = result->Fetch()[0].GetUInt32() + 1;
result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s", store.table); result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s", store.table);
if (result) if (result)
@@ -170,7 +170,7 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
if (store.iNumFields != result->GetFieldCount()) if (store.iNumFields != result->GetFieldCount())
{ {
store.RecordCount = 0; store.RecordCount = 0;
sLog->outError("Error in %s table, probably sql file format was updated (there should be %d fields in sql).\n", store.table, store.iNumFields); sLog->outError("Error loading table %s, probably table format was updated (there should be %u fields in sql).\n", store.table, store.iNumFields);
exit(1); // Stop server at loading broken or non-compatible table. exit(1); // Stop server at loading broken or non-compatible table.
} }
@@ -216,13 +216,9 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store)
} }
++count; ++count;
} } while (result->NextRow());
while( result->NextRow() );
delete result;
store.pIndex = newIndex; store.pIndex = newIndex;
store.MaxEntry = maxi; store.MaxEntry = maxi;
store.data = _data; store.data = _data;
} }