Core/DataStores: Added sparse storage flag assertion

This commit is contained in:
Shauren
2016-07-17 16:07:25 +02:00
parent 2056ce4d66
commit a5f6a80f0c
2 changed files with 5 additions and 2 deletions

View File

@@ -165,6 +165,8 @@ bool DB2SparseFileLoader::Load(const char *filename, DB2Meta const* meta)
EndianConvert(metaFlags);
ASSERT((metaFlags & 0x1) != 0, "%s is not a sparse storage, use DB2Storage!", filename);
fields = new FieldEntry[fieldCount];
if (fread(fields, fieldCount * sizeof(FieldEntry), 1, f) != 1)
{

View File

@@ -167,6 +167,7 @@ bool DB2FileLoader::Load(char const* filename, DB2Meta const* meta)
EndianConvert(metaFlags);
ASSERT((metaFlags & 0x1) == 0, "%s is a sparse storage, use DB2SparseStorage!", filename);
ASSERT((meta->IndexField == -1) || (meta->IndexField == (metaFlags >> 16)));
fields = new FieldEntry[fieldCount];
@@ -275,7 +276,8 @@ char* DB2FileLoader::AutoProduceData(uint32& records, char**& indexTable)
for (uint32 y = 0; y < recordCount; y++)
{
uint32 indexVal = meta->HasIndexFieldInData() ? getRecord(y).getUInt(indexField, 0) : ((uint32*)idTable)[y];
Record rec = getRecord(y);
uint32 indexVal = meta->HasIndexFieldInData() ? rec.getUInt(indexField, 0) : ((uint32*)idTable)[y];
indexTable[indexVal] = &dataTable[offset];
@@ -285,7 +287,6 @@ char* DB2FileLoader::AutoProduceData(uint32& records, char**& indexTable)
offset += 4;
}
Record rec = getRecord(y);
for (uint32 x = 0; x < fieldCount; ++x)
{
for (uint32 z = 0; z < meta->ArraySizes[x]; ++z)