Core/DataStores: Implemented uint64 field type for DBC files and fixed structure of Achievement_Criteria.dbc

This commit is contained in:
Shauren
2014-06-27 00:37:17 +02:00
parent 21687aa857
commit a2b860b781
7 changed files with 101 additions and 84 deletions
+13 -1
View File
@@ -90,8 +90,10 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
for (uint32 i = 1; i < fieldCount; ++i)
{
fieldsOffset[i] = fieldsOffset[i - 1];
if (fmt[i - 1] == 'b' || fmt[i - 1] == 'X') // byte fields
if (fmt[i - 1] == FT_BYTE || fmt[i - 1] == FT_NA_BYTE) // byte fields
fieldsOffset[i] += sizeof(uint8);
else if (fmt[i - 1] == FT_LONG)
fieldsOffset[i] += sizeof(uint64);
else // 4 byte fields (int32/float/strings)
fieldsOffset[i] += sizeof(uint32);
}
@@ -152,6 +154,9 @@ uint32 DBCFileLoader::GetFormatRecordSize(const char* format, int32* index_pos)
case FT_BYTE:
recordsize += sizeof(uint8);
break;
case FT_LONG:
recordsize += sizeof(uint64);
break;
case FT_NA:
case FT_NA_BYTE:
break;
@@ -242,6 +247,10 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**
*((uint8*)(&dataTable[offset])) = getRecord(y).getUInt8(x);
offset += sizeof(uint8);
break;
case FT_LONG:
*((uint64*)(&dataTable[offset])) = getRecord(y).getUInt64(x);
offset += sizeof(uint64);
break;
case FT_STRING:
*((char**)(&dataTable[offset])) = NULL; // will replace non-empty or "" strings in AutoProduceStrings
offset += sizeof(char*);
@@ -288,6 +297,9 @@ char* DBCFileLoader::AutoProduceStrings(const char* format, char* dataTable)
case FT_BYTE:
offset += sizeof(uint8);
break;
case FT_LONG:
offset += sizeof(uint64);
break;
case FT_STRING:
{
// fill only not filled entries